Exemplo n.º 1
0
 /**
  * @return void
  */
 private static function _init()
 {
     global $DB, $CACHE_MANAGER;
     if (isset(self::$arBuckets)) {
         return;
     }
     $cache_id = "cloud_buckets_v2";
     if (CACHED_b_clouds_file_bucket !== false && $CACHE_MANAGER->Read(CACHED_b_clouds_file_bucket, $cache_id, "b_clouds_file_bucket")) {
         self::$arBuckets = $CACHE_MANAGER->Get($cache_id);
     } else {
         self::$arBuckets = array();
         $rs = $DB->Query("\n\t\t\t\tSELECT *\n\t\t\t\tFROM b_clouds_file_bucket\n\t\t\t\tORDER BY SORT DESC, ID ASC\n\t\t\t");
         while (is_array($ar = $rs->Fetch())) {
             if ($ar["FILE_RULES"] != "") {
                 $arRules = unserialize($ar["FILE_RULES"]);
             } else {
                 $arRules = array();
             }
             $ar["FILE_RULES_COMPILED"] = self::CompileRules($arRules);
             if ($ar["SETTINGS"] != "") {
                 $arSettings = unserialize($ar["SETTINGS"]);
             } else {
                 $arSettings = array();
             }
             if (is_array($arSettings)) {
                 $ar["SETTINGS"] = $arSettings;
             } else {
                 $ar["SETTINGS"] = array();
             }
             self::$arBuckets[intval($ar['ID'])] = $ar;
         }
         if (CACHED_b_clouds_file_bucket !== false) {
             $CACHE_MANAGER->Set($cache_id, self::$arBuckets);
         }
     }
 }