Example #1
0
 private static function cache_thumb_info($hash, $data)
 {
     \System\File::put(ROOT . self::DIR_CACHE . '/' . $hash, json_encode($data));
 }
Example #2
0
 /** Save module settings
  * @param string $module
  * @param string $env
  */
 public static function save($module, $env = null)
 {
     is_null($env) && ($env = self::$env);
     $path = BASE_DIR . self::DIR_CONF_DIST . '/' . $env . '/' . $module . ".json";
     $data = \System\Json::json_humanize(json_encode(self::get($module)));
     if (!($action = \System\File::put($path, $data))) {
         throw new \System\Error\Permissions(sprintf('Failed to write settings. Please check your permissions on directory \'%s\'', ROOT . self::DIR_CONF_DIST));
     }
     self::purge_cache();
     self::reload();
     return $action;
 }
Example #3
0
 private static function resource_list_save($type, &$content)
 {
     $content = array_unique($content);
     $name = self::get_resource_list_name($content);
     $file = self::get_resource_list_path($type, $name);
     if (!file_exists($file)) {
         \System\File::put($file, implode(NL, $content));
     }
 }
Example #4
0
 public static function save()
 {
     \System\File::put(BASE_DIR . self::FILE_ROUTES_CACHE, json_encode(array("routes" => self::$routes, "menu" => self::$menu, "cfg" => self::$cfg)));
 }
Example #5
0
 /**
  * Update htaccess rules
  * @return bool
  */
 public static function update_rewrite()
 {
     if (!\System\File::check($p = BASE_DIR . \System\Loader::FILE_REWRITE)) {
         $val = \System\File::put($p, \Helper\Htaccess::generate_rewrite_rules());
         Status::report('info', "Rewrite rules refreshed");
         return $val;
     }
     return true;
 }
Example #6
0
 /** Put data formatted in JSON to path
  * @param string $path
  * @param mixed  $json
  * @return bool
  */
 public static function put($path, $json)
 {
     return \System\File::put($path, json_encode($json));
 }
Example #7
0
 public static function build_locales()
 {
     $cfg = \System\Settings::get('locales', 'allowed');
     $loc = new \System\Locales();
     foreach ($cfg as $lang) {
         $loc->load_messages($lang);
         \System\File::put(BASE_DIR . \System\Locales::DIR_CACHE . '/' . $lang . '.json', json_encode($loc->get_messages($lang)));
     }
 }