Ejemplo n.º 1
0
 private static function _load_catalog($force_reload = false, $get_contents_only = false)
 {
     if (is_object(self::$_catalogObj) && true !== $force_reload) {
         return self::$_catalogObj;
     }
     if (true === $force_reload) {
         unset(self::$_catalogObj);
     }
     $read_only = false;
     $ignore_lock = self::_fileoptions_lock_ignore_timeout_value();
     if (true === $get_contents_only) {
         $read_only = true;
         $ignore_lock = true;
     }
     require_once pb_backupbuddy::plugin_path() . '/classes/fileoptions.php';
     $catalogObj = new pb_backupbuddy_fileoptions(backupbuddy_core::getLogDirectory() . 'live/catalog-' . pb_backupbuddy::$options['log_serial'] . '.txt', $read_only, $ignore_lock, $create_file = true, $live_mode = true);
     if (true !== ($result = $catalogObj->is_ok())) {
         pb_backupbuddy::status('error', 'Error #239239034. Fatal error. Unable to create or access CATALOG fileoptions file. Details: `' . $result . '`. Waiting a moment before ending. Read only: `' . $read_only . '`, ignore lock: `' . $ignore_lock . '`, contents only: `' . $get_contents_only . '`. Caller: `' . backupbuddy_core::getCallingFunctionName() . '`.');
         sleep(3);
         // Wait a moment to give time for temporary issues to resolve.
         return false;
     }
     // Set defaults.
     if (!is_array($catalogObj->options)) {
         $catalogObj->options = array();
     }
     //$catalogObj->options = array_merge( self::$_catalogDefaults, $catalogObj->options );
     // Getting contents only.
     if (true === $get_contents_only) {
         return $catalogObj->options;
     }
     // Set class variables with references to object and options within.
     self::$_catalogObj =& $catalogObj;
     self::$_catalog =& $catalogObj->options;
     return true;
 }