Ejemplo n.º 1
0
 public static function update()
 {
     System::setRelativePublish(!self::addSwitch("a", "Generate absolute paths"));
     self::enableHelp();
     self::pinfo("Updating the application");
     Plugins::dispatchAllReversed("preupdate");
     Plugins::dispatchAllReversed("update");
     Plugins::dispatchAll("postupdate");
     Plugins::dispatchAll("clean");
 }
Ejemplo n.º 2
0
Archivo: error.php Proyecto: davbfr/cf
$this->out("body");
?>
</p>
	
<?php 
$bt = $this->get("backtrace");
if (count($bt) > 0) {
    try {
        $file = file_get_contents($bt[0][0]);
        $file = explode("\n", $file);
        $start = max($bt[0][1] - 4, 0);
        $end = min($bt[0][1] + 3, count($file));
        echo $bt[0][0];
        echo "<div class=\"alert alert-info code\">";
        for ($line = $start; $line < $end; $line++) {
            echo "<div" . ($line == $bt[0][1] - 1 ? " class=\"red\"" : "") . "><span>" . ($line + 1) . "</span> " . \DavBfr\CF\System::highlightCode($file[$line]) . "</div>";
        }
        echo "</div>";
    } catch (Exception $e) {
    }
}
?>
	
	<?php 
if ($this->has("backtrace") && count($this->get("backtrace")) > 0) {
    ?>
	<div class="well">
		<h2><?php 
    $this->tr("core.backtrace");
    ?>
</h2>
Ejemplo n.º 3
0
 public static function create()
 {
     $create_tpt = Cli::addSwitch("t", "Create templates");
     $models = Cli::getInputs("models", "Model names to create");
     Cli::enableHelp();
     $config = Config::getInstance();
     $rest = Plugins::get(Plugins::APP_NAME)->getDir() . DIRECTORY_SEPARATOR . self::REQUEST_DIR;
     System::ensureDir($rest);
     $ctrl = WWW_DIR . "/app/crud";
     System::ensureDir($ctrl);
     foreach ($models as $model) {
         $className = ucfirst($model) . "Rest";
         $modelClass = ucfirst($model) . "Model";
         Cli::pinfo(" * " . $className);
         $filename = $rest . "/" . $className . ".class.php";
         $tpt = new Template(array("className" => $className, "model" => $model, "umodel" => ucfirst($model), "modelClass" => $modelClass));
         if (!file_exists($filename)) {
             $f = fopen($filename, "w");
             fwrite($f, $tpt->parse("crud-rest-skel.php"));
             fclose($f);
         }
         $filename = $ctrl . "/" . $className . ".js";
         if (!file_exists($filename)) {
             $f = fopen($filename, "w");
             fwrite($f, $tpt->parse("crud-app-skel.php"));
             fclose($f);
         }
         if ($create_tpt) {
             $templates = Plugins::get(Plugins::APP_NAME)->getDir() . DIRECTORY_SEPARATOR . Template::TEMPLATES_DIR;
             System::ensureDir($templates);
             $afields = $config->get("model." . $model);
             $fields = array();
             foreach ($afields as $name => $prop) {
                 $fields[$name] = new ModelField($model, $name, $prop);
             }
             $options = self::defaultOptions();
             $tpt = new Template(array_merge($options, array("model" => $fields)));
             $filename = $templates . "/" . $model . "-crud-list.php";
             if (!file_exists($filename)) {
                 $f = fopen($filename, "w");
                 fwrite($f, $tpt->parse($options["list_partial"]));
                 fclose($f);
             }
             $filename = $templates . "/" . $model . "-crud-detail.php";
             if (!file_exists($filename)) {
                 $f = fopen($filename, "w");
                 fwrite($f, $tpt->parse($options["detail_partial"]));
                 fclose($f);
             }
         }
     }
 }
Ejemplo n.º 4
0
 public function symlink()
 {
     if (!file_exists($this->filename_cache)) {
         System::symlink($this->filename, $this->filename_cache);
     }
 }
Ejemplo n.º 5
0
 public function clean()
 {
     System::rmtree(CACHE_DIR);
     System::rmtree(WWW_CACHE_DIR);
 }
Ejemplo n.º 6
0
 public function testAbsPath()
 {
     $this->assertEquals(System::absPath("one/../two"), 'two');
     $this->assertEquals(System::absPath("one/./two"), 'one/two');
 }