/** * Usage (from command line): * * php oil r setupassets:less * * @return string */ public static function less() { try { $result_message = self::compile_less(); } catch (\FuelException $e) { return \Util_Task::output_message(sprintf('Compile less error: %s', $e->getMessage()), false); } return \Util_Task::output_result_message(true, $result_message); }
/** * Usage (from command line): * * php oil r user:delete user_id * * @return string */ public static function delete($user_id) { try { \Site_Member::delete($user_id); return \Util_Task::output_message(sprintf('Delete site user. id: %d', $user_id)); } catch (\FuelException $e) { return \Util_Task::output_message(sprintf('Delete site user error: %s', $e->getMessage()), false); } }
/** * Usage (from command line): * * php oil r setupfiles:less_setting * * @return string */ public static function update_less_setting() { try { $result = self::change_less_setting(); } catch (\FuelException $e) { return \Util_Task::output_message($e->getMessage(), false); } return true; }
private static function setup_assets($module, $module_dir_path) { $public_dir_path = DOCROOT; if (!file_exists($public_dir_path)) { throw new \FuelException('Not exists public dir.'); } chdir($public_dir_path . 'modules/'); $messages = array(); $module_dir_middle_path = sprintf('modules/%s/', $module); $module_public_dir_path = sprintf(APPPATH . $module_dir_middle_path . 'public/'); if (file_exists($module_public_dir_path) && !file_exists($public_dir_path . $module_dir_middle_path)) { $target_relative_path = '../../fuel/app/' . $module_dir_middle_path . 'public'; symlink($target_relative_path, $module); $messages[] = \Util_Task::output_message(sprintf("Add symlink '%s' to 'public/modules/%s'.", $target_relative_path, $module)); } $assets_base_dir_path = $public_dir_path . 'assets/'; $assets_dirs = array('css', 'img', 'js'); foreach ($assets_dirs as $asset_type) { if (!file_exists($assets_base_dir_path . $asset_type)) { continue; } if (!chdir($assets_base_dir_path . $asset_type . '/modules')) { continue; } if (file_exists(sprintf('%s%s/modules/%s', $assets_base_dir_path, $asset_type, $module))) { continue; } $module_assets_dir_path_suffix = sprintf('%sassets/%s', $module_dir_middle_path, $asset_type); if (!file_exists(APPPATH . $module_assets_dir_path_suffix)) { continue; } $target_relative_path = '../../../../fuel/app/' . $module_assets_dir_path_suffix; symlink($target_relative_path, $module); $messages[] = \Util_Task::output_message(sprintf("Add symlink '%s' to 'public/assets/%s/modules/%s'.", $target_relative_path, $asset_type, $module)); } return $messages; }
/** * Usage (from command line): * * php oil r setupdb:drop * * @return string */ public static function insert_default_data() { \Config::load('db_fixture', 'db_fixture'); try { $db_fixtures = \Config::get('db_fixture'); $result = self::load_fixtures($db_fixtures); } catch (\FuelException $e) { return \Util_Task::output_message(sprintf('Insert default data error: %s', $e->getMessage()), false); } return \Util_Task::output_result_message($result, __FUNCTION__ . ' db', 'Insert default data.'); }
/** * Usage (from command line): * * php oil r filecleaner:clean_cache * * @return string */ public static function clean_cache() { try { \Cache::delete_all(); } catch (\FuelException $e) { return \Util_Task::output_message(sprintf('%s error: %s', __FUNCTION__, $e->getMessage()), false); } return \Util_Task::output_result_message(true, __FUNCTION__, 'Delete all caches.'); }