Skip to content

Commit

Permalink
Merge branch 'master' into develop
Browse files Browse the repository at this point in the history
  • Loading branch information
darknoon29 committed Aug 14, 2024
2 parents 07ef3a3 + 191294a commit 0ebcb5e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 16 deletions.
36 changes: 23 additions & 13 deletions core/mod_list.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);

}
10 changes: 8 additions & 2 deletions core/tool_upgrade.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
* @version 2.1.9
*/

use Ogsteam\Ogspy\Model\Config_Model;

if (!defined('IN_SPYOGAME')) {
die("Hacking attempt");
}
Expand Down Expand Up @@ -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" . '<tr>' . "\n";
Expand Down
2 changes: 1 addition & 1 deletion version.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
autoupdate
3.2.3
autoupdate,AutoUpdate,autoupdate,autoupdate,autoupdate.php,1,1
3.3.2
3.3.7

0 comments on commit 0ebcb5e

Please sign in to comment.