コード例 #1
0
 /**
  * Initialize application resources
  *
  * @param void
  * @return null
  */
 function initialize_resources()
 {
     if (defined('USE_COOKIES') && USE_COOKIES) {
         Cookies::init(COOKIE_PREFIX, COOKIE_PATH, COOKIE_DOMAIN, COOKIE_SECURE);
     }
     // if
     if (defined('USE_FLASH') && USE_FLASH) {
         Flash::init();
     }
     // if
     if (defined('USE_CACHE') && USE_CACHE) {
         cache_use_backend(CACHE_BACKEND, array('lifetime' => CACHE_LIFETIME));
     }
     // if
 }
コード例 #2
0
        die;
    } else {
        if (is_error($restore_database)) {
            echo 'Cannot import database: ' . $restore_database->getMessage();
            die;
        }
    }
    // if
    // restore files
    $errors = array();
    special_copy_dir($backup_dir . '/upload', UPLOAD_PATH, false, $errors);
    special_copy_dir($backup_dir . '/projects_icons', ENVIRONMENT_PATH . '/' . PUBLIC_FOLDER_NAME . '/projects_icons', false, $errors);
    special_copy_dir($backup_dir . '/avatars', ENVIRONMENT_PATH . '/' . PUBLIC_FOLDER_NAME . '/avatars', false, $errors);
    special_copy_dir($backup_dir . '/logos', ENVIRONMENT_PATH . '/' . PUBLIC_FOLDER_NAME . '/logos', false, $errors);
    // clean cache
    cache_use_backend(CACHE_BACKEND, array('lifetime' => CACHE_LIFETIME));
    cache_clear();
    if (is_foreachable($errors)) {
        echo "<p>Backup restored, but with some errors (warnings)</p>";
        echo "<ul>";
        foreach ($errors as $error) {
            echo "<li>{$error}</li>";
        }
        // foreach
        echo "</ul>";
    } else {
        echo "<p>Backup restored!</p>";
    }
    // if
}
// if