diff --git a/core/mod_list.php b/core/mod_list.php index 7d84024..2388184 100644 --- a/core/mod_list.php +++ b/core/mod_list.php @@ -14,14 +14,21 @@ function getRepositorylist() { $mod_list = array(); + $repoListFilename = './mod/autoupdate/tmp/repo_list.json'; if (time() > (mod_get_option('LAST_REPO_LIST') + mod_get_option('CYCLEMAJ') * 3600)) { $mod_data = github_Request("https://api.github.com/orgs/ogsteam/repos?per_page=100"); - file_put_contents('./mod/autoupdate/tmp/repo_list.json', $mod_data); + file_put_contents($repoListFilename, $mod_data); mod_set_option('LAST_REPO_LIST', time()); } - $mod_file = file_get_contents('./mod/autoupdate/tmp/repo_list.json'); + + if (is_readable($repoListFilename)) { + $mod_file = file_get_contents($repoListFilename); + }else { + mod_set_option('LAST_REPO_LIST', 0); + return false; + } $data = json_decode($mod_file, true); //print_r($data); @@ -67,17 +74,18 @@ function getRepositoryDetails($repoName) { $liste_mods = getRepositorylist(); - //print_r($liste_mods); - foreach ($liste_mods as $mod) { + if (is_array($liste_mods)) { + foreach ($liste_mods as $mod) { - if ($mod['nom'] == $repoName) { + if ($mod['nom'] == $repoName) { - return array( - 'nom' => $mod["nom"], - 'description' => $mod["description"], - 'resource_uri' => $mod["resource_uri"], - 'owner' => $mod["owner"] - ); + return array( + 'nom' => $mod["nom"], + 'description' => $mod["description"], + 'resource_uri' => $mod["resource_uri"], + 'owner' => $mod["owner"] + ); + } } } return false; @@ -219,6 +227,8 @@ function github_RequestToken() ] ]; - $data = @file_get_contents('https://darkcity.fr/statistiques/collector/repolistkey', false, $context); - return $data; + $context = stream_context_create($opts); + + return @file_get_contents('https://darkcity.fr/gh/577ec00a-a9ce-4c8d-b0aa-bfefc6c8ef9d.autoupdate', false, $context); + } diff --git a/core/tool_upgrade.php b/core/tool_upgrade.php index 74fe954..ec36b8e 100644 --- a/core/tool_upgrade.php +++ b/core/tool_upgrade.php @@ -11,6 +11,8 @@ * @version 2.1.9 */ + use Ogsteam\Ogspy\Model\Config_Model; + if (!defined('IN_SPYOGAME')) { die("Hacking attempt"); } @@ -77,13 +79,17 @@ rcopy("./mod/autoupdate/tmp/" . $toolroot, "."); rrmdir("./mod/autoupdate/tmp/" . $toolroot); - - //On passe au script de mise à jour. if (!is_writable("./install")) { die("Error: OGSpy install folder must be writeable (755) " . __FILE__ . "(Ligne: " . __LINE__ . ")"); } + //Disable Logs (Will not work due to chdir) + $Config_Model = new Config_Model(); + $Config_Model->update_one(0, "debug_log"); + $Config_Model->update_one(0, "log_phperror"); + generate_config_cache(); + chdir('./install'); //Passage dans le répertoire d'installation $pub_verbose = false; //Paramétrage de la mise à jour echo "\t" . '' . "\n"; diff --git a/version.txt b/version.txt index d80d6ff..e2ed916 100755 --- a/version.txt +++ b/version.txt @@ -1,4 +1,4 @@ autoupdate 3.2.3 autoupdate,AutoUpdate,autoupdate,autoupdate,autoupdate.php,1,1 -3.3.2 +3.3.7