/** * Returns a list of backends available * * @access public * @return array An array of workflow backends */ function getBackendList() { $files = Misc::getFileList(APP_INC_PATH . "workflow"); $list = array(); for ($i = 0; $i < count($files); $i++) { // display a prettyfied backend name in the admin section if (preg_match('/^class\\.(.*)\\.php$/', $files[$i], $matches)) { if ($matches[1] == 'abstract_workflow_backend') { continue; } $name = ucwords(str_replace('_', ' ', $matches[1])); $list[$files[$i]] = $name; } } return $list; }
/** * Returns a list of backends available * * @return array An array of workflow backends */ public static function getBackendList() { $files = Misc::getFileList(APP_INC_PATH . '/workflow'); $files = array_merge($files, Misc::getFileList(APP_LOCAL_PATH . '/workflow')); $list = array(); foreach ($files as $file) { // display a prettyfied backend name in the admin section if (preg_match('/^class\\.(.*)\\.php$/', $file, $matches)) { if ($matches[1] == 'abstract_workflow_backend') { continue; } $name = ucwords(str_replace('_', ' ', $matches[1])); $list[$file] = $name; } } return $list; }
/** * Returns the list of available customer backends by listing the class * files in the backend directory. * * @access public * @return array Associative array of filename => name */ function getBackendList() { $files = Misc::getFileList(APP_INC_PATH . "customer"); $list = array(); for ($i = 0; $i < count($files); $i++) { // make sure we only list the customer backends if (preg_match('/^class\\./', $files[$i])) { // display a prettyfied backend name in the admin section preg_match('/class\\.(.*)\\.php/', $files[$i], $matches); if ($matches[1] == "abstract_customer_backend") { continue; } $name = ucwords(str_replace('_', ' ', $matches[1])); $list[$files[$i]] = $name; } } return $list; }
function getFileList($start_dir, $regex_filter = NULL, $recurse = FALSE) { return Misc::getFileList($start_dir, $regex_filter, $recurse); }
/** * Returns the list of available custom field backends by listing the class * files in the backend directory. * * @return array Associative array of filename => name */ public static function getBackendList() { $list = array(); $files = Misc::getFileList(APP_INC_PATH . '/custom_field'); $files = array_merge($files, Misc::getFileList(APP_LOCAL_PATH . '/custom_field')); foreach ($files as $file) { // make sure we only list the backends if (preg_match('/^class\\.(.*)\\.php$/', $file)) { // display a prettyfied backend name in the admin section $list[$file] = self::getBackendName($file); } } return $list; }
/** * Method used to get a random file from the 'daily tips' directory. * * @access public * @param object $tpl The template object * @return string Random filename */ function getRandomTip($tpl) { $tip_dir = $tpl->smarty->template_dir . "/tips"; $files = Misc::getFileList($tip_dir); $i = rand(0, (int) count($files)); // some weird bug in the rand() function where sometimes the // second parameter is non-inclusive makes us have to do this if (!isset($files[$i])) { return Misc::getRandomTip($tpl); } else { return $files[$i]; } }
/** * Returns a list of backends available * * @return array An array of workflow backends */ public static function getBackendList() { $files = Misc::getFileList(APP_INC_PATH . '/partner'); $files = array_merge($files, Misc::getFileList(APP_LOCAL_PATH . '/partner')); $list = array(); foreach ($files as $file) { // display a prettyfied backend name in the admin section if (preg_match('/^class\\.(.*)\\.php$/', $file, $matches)) { if (substr($matches[1], 0, 8) == 'abstract') { continue; } $list[$file] = $matches[1]; } } return $list; }
/** * Returns the list of available customer backends by listing the class * files in the backend directory. * * @return array Associative array of filename => name */ public static function getBackendList() { $files = Misc::getFileList(APP_INC_PATH . 'crm/'); $files = array_merge($files, Misc::getFileList(APP_LOCAL_PATH . '/crm')); $list = array(); foreach ($files as $file) { $list['class.' . $file . '.php'] = $file; } return $list; }
/** * Returns the list of available custom field backends by listing the class * files in the backend directory. * * @access public * @return array Associative array of filename => name */ function getBackendList() { $files = Misc::getFileList(APP_INC_PATH . "custom_field"); $list = array(); for ($i = 0; $i < count($files); $i++) { // make sure we only list the backends if (preg_match('/^class\\.(.*)\\.php$/', $files[$i])) { // display a prettyfied backend name in the admin section $list[$files[$i]] = Custom_Field::getBackendName($files[$i]); } } return $list; }
<?php include_once "../../../config.inc.php"; include_once APP_INC_PATH . "class.misc.php"; $compile_dir = APP_PATH . "templates_c"; $templates = Misc::getFileList($compile_dir); foreach ($templates as $filename) { unlink($compile_dir . '/' . $filename); } ?> done
} else { Debug::Text('Table not found for purging: ' . $table, __FILE__, __LINE__, __METHOD__, 10); } } $db->CompleteTrans(); } unset($purge_tables, $purge_extra_tables, $current_tables, $query); Debug::Text('Purging database tables complete: ' . TTDate::getDate('DATE+TIME', time()), __FILE__, __LINE__, __METHOD__, 10); } // // Clean cache directories // - Make sure cache directory is set, and log/storage directories are not contained within it. // if (!isset($config_vars['other']['disable_cache_purging']) or isset($config_vars['other']['disable_cache_purging']) and $config_vars['other']['disable_cache_purging'] != TRUE) { if (isset($config_vars['cache']['dir']) and $config_vars['cache']['dir'] != '' and strpos($config_vars['path']['log'], $config_vars['cache']['dir']) === FALSE and strpos($config_vars['path']['storage'], $config_vars['cache']['dir']) === FALSE) { Debug::Text('Purging Cache directory: ' . $config_vars['cache']['dir'] . ' - ' . TTDate::getDate('DATE+TIME', time()), __FILE__, __LINE__, __METHOD__, 10); $cache_files = Misc::getFileList($config_vars['cache']['dir'], NULL, TRUE); if (is_array($cache_files)) { foreach ($cache_files as $cache_file) { if (strpos($cache_file, '.lock') === FALSE) { @unlink($cache_file); } } } Debug::Text('Purging Cache directory complete: ' . TTDate::getDate('DATE+TIME', time()), __FILE__, __LINE__, __METHOD__, 10); } else { Debug::Text('Cache directory is invalid: ' . TTDate::getDate('DATE+TIME', time()), __FILE__, __LINE__, __METHOD__, 10); } } Debug::writeToLog(); Debug::Display();
function getLockFiles() { $start_dir = $this->getLockFileDirectory(); $regex_filter = $this->getLockFilePrefix() . '\\.lock.*'; $retarr = Misc::getFileList($start_dir, $regex_filter, FALSE); //Debug::Arr($retarr, ' Existing Lock Files: ', __FILE__, __LINE__, __METHOD__, 10); $this->purgeLockFiles($retarr); return $retarr; }
/* * migrate pids and locks to new location * * https://github.com/eventum/eventum/pull/81 */ $old_dir = APP_PATH . '/locks'; $new_dir = APP_LOCKS_PATH; if (realpath($old_dir) == realpath($new_dir)) { // user has decided to use old structure, nothing to migrate return; } if (!Misc::isWritableDirectory($new_dir)) { // shouldn't happen throw new UnexpectedValueException('APP_LOCKS_PATH is not writable'); } $files = Misc::getFileList($old_dir); if (!$files) { // nothing to migrate return; } /** @var Closure $log */ $count = count($files); $log("Migrating {$count} files from {$old_dir} to {$new_dir}"); foreach ($files as $file) { $old_file = "{$old_dir}/{$file}"; $new_file = "{$new_dir}/{$file}"; $res = copy($old_file, $new_file); if ($res == false) { throw new BadMethodCallException("Could not copy {$file}"); } // preserve timestamp