Пример #1
0
/**
 * Find and load the real ZFDemo bootstrap.php file
 */
function ZFDemoGrub($installDir, $configEnv)
{
    error_reporting(E_ALL | E_STRICT);
    // verbose
    $ds = DIRECTORY_SEPARATOR;
    // too much typing ;)
    // where to find this application's configuration (using Conventional Modular Layout)
    if ($installDir[0] === $ds) {
        $tmp = $installDir;
        $appDir = $tmp;
        // skip costly realpath($tmp)
    } else {
        $tmp = dirname(__FILE__) . $ds . '..' . $ds . '..' . $ds . 'zfdemo' . $ds . $installDir;
        $appDir = realpath($tmp) . $ds;
    }
    // show installation help, if loading bootstrap fails
    if ((include $appDir . 'bootstrap.php') === false) {
        $log = "Looking for application directory in:\n    realpath({$tmp}" . $ds . ")\n";
        $log .= "    = {$appDir}bootstrap.php\n";
        $file = __FILE__;
        echo <<<EOD
            <html><head><title>ZFDemo - Installation problem</title></head><body>
            <pre>{$log}</pre>
            <h1>Instructions</h1>
            <p>Check for existence and permissions of the directories above.</p>
            <p>Then edit "\$installDir" in this file ( {$file} ).</p>
            <p>See also: <a href="http://framework.zend.com/wiki/display/ZFDEV/Tutorial"
            >http://framework.zend.com/wiki/display/ZFDEV/Tutorial</a></p>
            </body></html>
EOD;
        exit;
    }
    if (false === ZFDemo::bootstrap($installDir, $appDir, $configEnv)) {
        // Run!
        ZFDemo_log::show();
    }
}
Пример #2
0
 * diagnostics to help with installation issues.
 * Also, the code below is not intended to show best practices,
 * but only to help debug problems getting the real demo working.
 *
 * Change localhost to the correct name for your virtual web server setup:
 * http://localhost/zfdemo_debug/
 */
//$installDir = '/cygdrive/c/gavin/home/lighttpd/zf/zfdemo/section1_install/';
$installDir = 'section1_install';
// absolute real paths are also ok
error_reporting(E_ALL | E_STRICT);
// verbose
require 'Zend/Registry.php';
require 'Zend/Date.php';
require 'Zend/Debug.php';
if (ZFDemo::bootstrap($installDir) === false) {
    // Run!
    ZFDemo_Log::show();
}
class ZFDemo
{
    public static $environment;
    // which application configuration variant? live, staging, etc.
    public static $registry;
    // set of <key,value> pairs for misc. information
    public static $view;
    // view used to collect and render final output
    public static function bootstrap($installDir)
    {
        if (self::testEnvironment() === false) {
            echo 'Environment fails to meet minimum requirements for this demo tutorial.';