예제 #1
0
 $updater->upgradeLog("The main site has been updated", true, "Success");
 // plugins
 $allplugins = $plugins->getAllPlugins();
 $plugins_to_update = $updater->getSupportedPlugins($allplugins);
 if (count($plugins_to_update)) {
     foreach ($plugins_to_update as $addon_id => $plugin_data) {
         $error = false;
         // get license
         $plugin_license_key = $settings->getSetting($plugin_data['key_name'], false);
         if (!$plugin_license_key) {
             $updater->upgradeLog("Validating {$plugin_data['name']} plugin...", false, "No license key");
             $error = true;
         }
         if (!$error) {
             // check license
             if (!$updater->validateLicense($curl, 0, $addon_id, $plugin_license_key)) {
                 $updater->upgradeLog("Validating {$plugin_data['name']} plugin...", false, "Invalid license key");
                 $error = true;
             } else {
                 $updater->upgradeLog("Validating {$plugin_data['name']} plugin...", true, "Success");
             }
         }
         if (!$error) {
             $release_files = $curl->get($updater->api_path . "?method=getFileList&key=" . $license_key . "&addon_id=" . $addon_id);
             if ($curl->getHttpCode() >= 200 && $curl->getHttpCode() < 400) {
                 $release_files = json_decode($release_files, true);
                 if (!isset($release_files[$latest_version]) || !count($release_files[$latest_version])) {
                     $updater->upgradeLog("Getting plugin file list ({$plugin_data['name']})...", false, "No new files");
                     $error = true;
                 } else {
                     $updater->upgradeLog("Getting plugin file list ({$plugin_data['name']})...", true, "Success");