/** * Synchronize the code base * * This method is invoked whenever someone clicks on the "Sync" button. It * looks at the actions, looks at the existing files and either generate * the action if the action file doesn't exist or updates it whenever * it has to be updated (New required parameters, etc). * * @return void */ public function sync() { $actions = $this->config->getAll('action'); foreach ($actions as $key => $a) { $description = isset($a['description']) ? $a['description'] : false; $route = isset($a['route']) ? $a['route'] : false; if (empty($a)) { continue; } $params = array(); if (isset($a['parameters']['parameter'])) { $params = $a['parameters']['parameter']; } if (count($params) && !isset($params[0])) { $params = array($params); } $p = array(); if (!empty($params)) { foreach ($params as $param) { if ($param['required'] == '1') { $p[] = $param['name']; } } } $name = ucfirst(strtolower($a['name'])); $dir = ROOT_PATH . DIRECTORY_SEPARATOR . 'custom' . DIRECTORY_SEPARATOR . 'Action'; $file = $dir . DIRECTORY_SEPARATOR . $name . '.php'; if (!file_exists($file)) { $content = $this->generateAction($name, $p, $description, $route); } else { $content = $this->updateAction($file, $name, $p); } if ($content !== false && $content !== null && strlen($content) > 8) { // Do atomic move $tempName = $name . sha1(mt_rand(1, 100000000) . microtime(true)) . '.php'; file_put_contents($dir . DIRECTORY_SEPARATOR . $tempName, $content); rename($dir . DIRECTORY_SEPARATOR . $tempName, $file); chmod($file, 0777); } } $this->refreshAPCCache(); }
/** * Get all mimetypes * * Get all the mimetypes. * * @return mixed Either boolean false or an array of all mimetypes. */ public function getAll() { $mimetypes = $this->config->getAll('mimetype'); return $mimetypes; }
/** * Get all users * * Get all the users. * * @return mixed Either boolean false or an array of all users. */ public function getAll() { $users = $this->config->getAll('user'); return $users; }