function clearOldFiles() { $files = FileUtils::getFiles("../tmpworksheets"); foreach ($files as $fName) { if (filectime($fName) < time() - 1 * 60 * 60) { unlink($fName); } } }
public function longHelp($params) { if (count($params) == 0) { $this->line('Invoques an app-specific subcommand'); $this->line('Usage:'); $this->line('app [COMMAND_NAME] [[COMMAND_PARAMETERS]]'); $this->line(''); $this->line('You can also get help from a subcommand if provided using:'); $this->line('help app [COMMAND_NAME]'); $this->line('============'); $this->line('Here is a list of available app-specific commands:'); $commandsPath = APP_ROOT . 'app/' . APP_NAME . '/commands/'; foreach (FileUtils::getFiles($commandsPath, 'php') as $afile) { $commandName = strtolower(basename($afile, '.php')); $command = self::factory($commandName); $this->line("\t" . $commandName); $command->shortHelp(); } } else { $commandName = array_shift($params); self::factory($commandName)->longHelp($params); } }
protected static function _migrations_in_folder($folder, &$out) { foreach (FileUtils::getFiles($folder) as $file) { if (preg_match('`^(\\d+)_(.+)\\.(php|sql)$`', basename($file), $matches)) { $out[$matches[1]] = array('file' => $folder . $file, 'class' => 'Migration_' . Strings::camel($matches[2]), 'description' => str_replace('_', ' ', $matches[2]), 'type' => $matches[3]); } } }