示例#1
0
 public function install()
 {
     $bdd = Bdd::getInstance();
     $filename = DATA_DIR . "/data.json";
     Cli::pinfo("Import {$filename} in database");
     $data = json_decode(file_get_contents($filename));
     $bdd->import($data);
 }
示例#2
0
文件: Skel.plugin.php 项目: davbfr/cf
 public function skelUpdate()
 {
     Cli::enableHelp();
     Cli::pinfo("Update CF project");
     $srcdir = $this->getDir() . DIRECTORY_SEPARATOR . "project";
     $dstdir = ROOT_DIR;
     foreach (array("index.php", "setup", "README.md", ".htaccess", ".gitignore", "www/index.php", "www/.htaccess") as $file) {
         copy($srcdir . DIRECTORY_SEPARATOR . $file, $dstdir . DIRECTORY_SEPARATOR . $file);
     }
     $this->updateFiles();
     chmod(getcwd() . DIRECTORY_SEPARATOR . "setup", 0755);
     System::ensureDir(DATA_DIR);
     Cli::update();
 }
示例#3
0
文件: Bdd.plugin.php 项目: davbfr/cf
 public function install()
 {
     Cli::pinfo(" * Create database structure");
     $bdd = Bdd::getInstance();
     if (is_dir(self::MODEL_DIR)) {
         if ($dh = opendir(self::MODEL_DIR)) {
             while (($file = readdir($dh)) !== false) {
                 if (substr($file, -15) == "Model.class.php" && substr($file, 0, 4) != "Base") {
                     $class = __NAMESPACE__ . "\\" . substr($file, 0, -10);
                     $model = new $class();
                     $bdd->dropTable($model->getTableName());
                     $model->createTable();
                 }
             }
             closedir($dh);
         }
     }
 }
示例#4
0
 public static function minify_images()
 {
     $path = Cli::addOption("path", WWW_PATH, "Path where to find images");
     $norun = Cli::addSwitch("n", "Do not run the scripts, only print files to process");
     Cli::enableHelp();
     Cli::pinfo("Minify images");
     foreach (self::globRecursive($path . "/*.[pP][nN][gG]", GLOB_NOSORT) as $png) {
         Cli::pinfo(" * {$png}");
         $output = "";
         $return_var = -1;
         $cmd = "pngcrush -ow -brute -reduce {$png}";
         if ($norun) {
             Logger::Debug("   > {$cmd}");
         } else {
             exec("{$cmd} 2>& 1", $output, $return_var);
             if ($return_var != 0) {
                 Cli::perr(implode($output, "\n"));
             } else {
                 Logger::Debug(implode($output, "\n"));
             }
         }
     }
     foreach (self::globRecursive($path . "/{*.[jJ][pP][gG], *.[jJ][pP][eE][gG]}", GLOB_BRACE | GLOB_NOSORT) as $jpg) {
         Cli::pinfo(" * {$jpg}");
         $output = "";
         $return_var = -1;
         $cmd = "jpegoptim -s -v -v {$jpg}";
         if ($norun) {
             Logger::Debug("   > {$cmd}");
         } else {
             exec("{$cmd} 2>& 1", $output, $return_var);
             if ($return_var != 0) {
                 Cli::perr(implode($output, "\n"));
             } else {
                 Logger::Debug(implode($output, "\n"));
             }
         }
     }
 }
示例#5
0
 public function update()
 {
     Cli::pinfo(" * install Angular");
     System::publish($this->getDir() . "/www/vendor/angular/i18n");
 }
示例#6
0
 public function update()
 {
     Cli::pinfo(" * install Bootstrap");
     System::publish($this->getDir() . "/www/vendor/fonts");
 }
示例#7
0
文件: Bdd.class.php 项目: davbfr/cf
 public static function cliImport($args)
 {
     $files = Cli::getInputs("files", "file names to import");
     Cli::enableHelp();
     $bdd = self::getInstance();
     foreach ($files as $filename) {
         Cli::pinfo("Import {$filename} in database");
         $data = json_decode(file_get_contents($filename));
         $bdd->import($data);
     }
 }