Esempio n. 1
0
 public static function handleRequest()
 {
     $GLOBALS['Session']->requireAccountLevel('Developer');
     \Emergence_FS::cacheTree('site-root/site-admin');
     return static::respond('siteAdminIndex', array('scripts' => array_filter(\Emergence_FS::getAggregateChildren('site-root/site-admin'), function ($script) {
         return $script->Handle != '_index.php';
     })));
 }
Esempio n. 2
0
if (empty($_GET['suite'])) {
    ?>
        <h1>Available PHPUnit Test Suites</h1>
        <ul>
        <?php 
    Emergence_FS::cacheTree('phpunit-tests');
    foreach (Emergence_FS::getAggregateChildren('phpunit-tests') as $testsSubNode) {
        if (!is_a($testsSubNode, 'SiteCollection')) {
            continue;
        }
        print "<li><a href='?suite={$testsSubNode->Handle}'>{$testsSubNode->Handle}</a> <form action='/phpunit/run?suite={$testsSubNode->Handle}' method='POST' style='display:inline'><input type='submit' value='Run All Tests'></form></li>";
    }
    ?>
        </ul>
    <?php 
} elseif (count($testNodes = Emergence_FS::getAggregateChildren("phpunit-tests/{$_GET['suite']}"))) {
    ?>
        <h1>Tests in suite <?php 
    echo htmlspecialchars($_GET['suite']);
    ?>
</h1>
        <form action="/phpunit/run?suite=<?php 
    echo urlencode($_GET['suite']);
    ?>
"" method='POST'>
            <input type='submit' value='Run All Tests'>
        </form>
        <ul>
        <?php 
    foreach ($testNodes as $testNode) {
        if (is_a($testNode, 'SiteCollection')) {
Esempio n. 3
0
 public static function loadConfig($className)
 {
     $cacheKey = 'class-config:' . $className;
     if (!($configFileIds = Cache::fetch($cacheKey))) {
         $configFileIds = array();
         // look for primary config file
         if ($lastNsPos = strrpos($className, '\\')) {
             $namespace = substr($className, 0, $lastNsPos);
             $className = substr($className, $lastNsPos + 1);
             $path = str_replace('\\', DIRECTORY_SEPARATOR, $namespace) . DIRECTORY_SEPARATOR;
         } else {
             $path = '';
         }
         $path .= str_replace('_', DIRECTORY_SEPARATOR, $className);
         $configFileNode = Site::resolvePath("php-config/{$path}.config.php");
         // Fall back on looking for Old_School_Underscore_Namespacing in root
         if (!$configFileNode && empty($namespace) && $path != $className) {
             $configFileNode = Site::resolvePath("php-config/{$className}.config.php");
         }
         if ($configFileNode && $configFileNode->MIMEType == 'application/php') {
             $configFileIds[] = $configFileNode->ID;
         }
         // look for composite config files
         $collectionPath = "php-config/{$path}.config.d";
         Emergence_FS::cacheTree($collectionPath);
         foreach (Emergence_FS::getAggregateChildren($collectionPath) as $filename => $node) {
             if ($node->Type == 'application/php') {
                 $configFileIds[] = $node->ID;
             }
         }
         Cache::store($cacheKey, $configFileIds);
     }
     foreach ($configFileIds as $id) {
         require SiteFile::getRealPathByID($id);
     }
 }