Added "jar" file to alleviate overhead of __autoload() look ups and decrease the number of included files to load a page.

This commit is contained in:
Josh Sherman 2011-06-01 22:55:52 -04:00
parent bf4b86116f
commit afac101ba5
2 changed files with 6128 additions and 0 deletions

6087
jar.php Normal file

File diff suppressed because it is too large Load diff

View file

@ -53,6 +53,47 @@ define('JSON_AVAILABLE', function_exists('json_encode'));
// Creates a variable to flag if we're on the command line
define('IS_CLI', !isset($_SERVER['REQUEST_METHOD']));
// }}}
// {{{ Attempts to JAR the PICKLES - Har Har.
function readFileContents($directory)
{
$contents = '';
$files = scandir($directory);
foreach ($files as $file)
{
if (!in_array($file, array('.', '..')))
{
$file = $directory . '/' . $file;
if (is_dir($file))
{
$contents .= readFileContents($file);
}
else
{
$contents .= file_get_contents($file);
}
}
}
return $contents;
}
$jar_file = PICKLES_PATH . 'jar.php';
// The PICKLES path should only be writable in a development environment, never on a production server
if (is_writable(PICKLES_PATH))
{
file_put_contents(dirname(__FILE__) . '/jar.php', str_replace("\n?>\n<?php\n", '', readFileContents(PICKLES_CLASS_PATH)));
}
if (file_exists($jar_file))
{
require $jar_file;
}
// }}}
// {{{ Defaults some important configuration options