public static function handleRequest() { if (extension_loaded('newrelic')) { newrelic_disable_autorum(); } // retrieve authentication attempt if ($GLOBALS['Session']->hasAccountLevel('Developer')) { $User = $GLOBALS['Session']->Person; } else { $authEngine = new \Sabre\HTTP\BasicAuth(); $authEngine->setRealm('Develop ' . \Site::$title); $authUserPass = $authEngine->getUserPass(); // try to get user $userClass = \User::$defaultClass; $User = $userClass::getByLogin($authUserPass[0], $authUserPass[1]); // send auth request if login is inadiquate if (!$User || !$User->hasAccountLevel('Developer')) { $authEngine->requireLogin(); die("You must login using a " . \Site::getConfig('primary_hostname') . " account with Developer access\n"); } } // store login to session if (isset($GLOBALS['Session'])) { $GLOBALS['Session'] = $GLOBALS['Session']->changeClass('UserSession', array('PersonID' => $User->ID)); } // detect base path $basePath = array_slice(\Site::$requestPath, 0, count(\Site::$resolvedPath)); // switch to JSON response mode if (static::peekPath() == 'json') { $basePath[] = static::$responseMode = static::shiftPath(); } // handle /develop request if ($_SERVER['REQUEST_METHOD'] == 'GET' && static::getResponseMode() == 'html' && !static::peekPath()) { \RequestHandler::respond('app/ext', array('App' => \Sencha_App::getByName('EmergenceEditor'), 'mode' => 'production', 'title' => 'EmergenceEditor')); } // initial and configure SabreDAV $server = new \Sabre\DAV\Server(new RootCollection()); $server->setBaseUri('/' . join('/', $basePath)); // The lock manager is reponsible for making sure users don't overwrite each others changes. Change 'data' to a different // directory, if you're storing your data somewhere else. # $lockBackend = new Sabre_DAV_Locks_Backend_FS('/tmp/dav-lock'); # $lockPlugin = new Sabre_DAV_Locks_Plugin($lockBackend); # $server->addPlugin($lockPlugin); // filter temporary files $server->addPlugin(new \Sabre\DAV\TemporaryFileFilterPlugin('/tmp/dav-tmp')); // ?mount support $server->addPlugin(new \Sabre\DAV\Mount\Plugin()); // emergence :) $server->addPlugin(new \Emergence\DAV\ServerPlugin()); // All we need to do now, is to fire up the server $server->exec(); }
<?php /** THIS SCRIPT HAS NOT BEEN VERIFIED TO WORK CORRECTLY YET FOR ANY PARTICULAR CMD UPGRADE PATHS **/ $GLOBALS['Session']->requireAccountLevel('Developer'); set_time_limit(0); Benchmark::startLive(); // get app name if (empty($_REQUEST['name'])) { die('Parameter name required'); } $appName = $_REQUEST['name']; $App = new Sencha_App($appName); // get target framework version if (empty($_REQUEST['cmdVersion'])) { die('Parameter cmdVersion required'); } $cmdVersion = $_REQUEST['cmdVersion']; Benchmark::mark("configured request: appName={$appName}"); // get framework $framework = $App->getFramework(); $frameworkVersion = $App->getFrameworkVersion(); if (!$frameworkVersion) { die("Unable to determine framework version, if this is an old application you need to manually set app.framework.version in .sencha/app/sencha.cfg"); } // set paths $workspacePath = 'sencha-workspace'; $workspaceConfigPath = "{$workspacePath}/.sencha"; $frameworkPath = "{$workspacePath}/{$framework}-{$frameworkVersion}"; $packagesPath = "{$workspacePath}/packages"; $appPath = "{$workspacePath}/{$appName}"; $archivePath = "sencha-build/{$appName}/archive";
<?php $GLOBALS['Session']->requireAccountLevel('Developer'); set_time_limit(0); $defaultExclude = array("#/\\.sass-cache(/|\$)#", "#/\\.sencha-backup(/|\$)#", "#/\\.emergence(/|\$)#"); if (empty($_GET['dumpWorkspace'])) { Benchmark::startLive(); } // get app name if (empty($_REQUEST['name'])) { die('Parameter name required'); } $appName = $_REQUEST['name']; $App = new Sencha_App($appName); Benchmark::mark("configured request: appName={$appName}"); // get framework $framework = $App->getFramework(); $frameworkVersion = $App->getFrameworkVersion(); $cmdVersion = $App->getBuildCfg('app.cmd.version'); if (!$frameworkVersion) { die("Unable to determine framework version, if this is an old application you need to manually set app.framework.version in .sencha/app/sencha.cfg"); } if (!$cmdVersion) { die("Unable to determine CMD version, if this is an old application you need to manually set app.cmd.version in .sencha/app/sencha.cfg"); } // set paths $workspacePath = 'sencha-workspace'; $workspaceConfigPath = "{$workspacePath}/.sencha"; $frameworkPath = "{$workspacePath}/{$framework}-{$frameworkVersion}"; $packagesPath = "{$workspacePath}/packages"; $appPath = "{$workspacePath}/{$appName}";
<?php $GLOBALS['Session']->requireAccountLevel('Developer'); set_time_limit(0); $defaultExclude = array("#/\\.sass-cache(/|\$)#", "#/\\.sencha-backup(/|\$)#", "#/\\.emergence(/|\$)#"); if (empty($_GET['dumpWorkspace'])) { Benchmark::startLive(); } // get app name if (empty($_REQUEST['name'])) { die('Parameter name required'); } $appName = $_REQUEST['name']; $App = new Sencha_App($appName); // get build type if (empty($_REQUEST['buildType'])) { $buildType = 'production'; } else { $buildType = $_REQUEST['buildType']; } Benchmark::mark("configured request: appName={$appName}"); // get framework $framework = $App->getFramework(); $frameworkVersion = $App->getFrameworkVersion(); $cmdVersion = $App->getBuildCfg('app.cmd.version'); if (!$frameworkVersion) { die("Unable to determine framework version, if this is an old application you need to manually set app.framework.version in .sencha/app/sencha.cfg"); } if (!$cmdVersion) { die("Unable to determine CMD version, if this is an old application you need to manually set app.cmd.version in .sencha/app/sencha.cfg"); }
public static function handleCacheManifestRequest(Sencha_App $App) { $templateNode = Emergence\Dwoo\Template::findNode($App->getFramework() . '.tpl'); $cacheConfig = $App->getAppCfg('appCache'); header('Content-Type: text/cache-manifest'); echo "CACHE MANIFEST\n"; echo "# {$templateNode->SHA1}\n"; if (!empty($cacheConfig['cache']) && is_array($cacheConfig['cache'])) { foreach ($cacheConfig['cache'] as $path) { if ($path != 'index.html') { $path = "build/production/{$path}"; echo "{$path}\n"; if ($assetNode = $App->getAsset($path)) { echo "#{$assetNode->SHA1}\n"; } } } } if (!empty($_GET['platform']) && !empty($cacheConfig['platformCache']) && !empty($cacheConfig['platformCache'][$_GET['platform']]) && is_array($cacheConfig['platformCache'][$_GET['platform']])) { echo "\n# {$_GET['platform']}:\n"; foreach ($cacheConfig['platformCache'][$_GET['platform']] as $path) { $path = "build/production/{$path}"; if ($assetNode = $App->getAsset($path)) { echo "{$path}\n"; echo "#{$assetNode->SHA1}\n"; } } } echo "\nFALLBACK:\n"; if (!empty($cacheConfig['fallback']) && is_array($cacheConfig['fallback'])) { foreach ($cacheConfig['fallback'] as $path) { echo "{$path}\n"; } } echo "\nNETWORK:\n"; if (!empty($cacheConfig['network']) && is_array($cacheConfig['network'])) { foreach ($cacheConfig['network'] as $path) { echo "{$path}\n"; } } echo "\n# TRIGGERS:\n"; $templateNode = Emergence\Dwoo\Template::findNode($App->getFramework() . '.tpl'); echo "#template: {$templateNode->SHA1}\n"; if (!empty($cacheConfig['triggers']) && is_array($cacheConfig['triggers'])) { foreach ($cacheConfig['triggers'] as $path) { $assetNode = $path[0] == '/' ? Site::resolvePath($path) : $App->getAsset($path); if ($assetNode) { echo "#{$assetNode->SHA1}\n"; } } } exit; }
<?php $GLOBALS['Session']->requireAccountLevel('Staff'); Sencha_RequestHandler::respond('app/SlateAdmin/ext', array('App' => Sencha_App::getByName('SlateAdmin'), 'mode' => 'production'));