Hallo,
ich habe nach langem Suchen ein Script im Internet gefunden, allerdings klappt es nicht richtig:
<?
ini_set('max_execution_time',60);
//Suche nach Updates
$getVersions = file_get_contents('https://test.musicintime.de/current-release-versions.php') or die ('ERROR');
$current_version = file_get_contents('../include/version.txt');
if ($getVersions != '')
{
echo 'Aktuelle Version: '.$current_version;
echo 'Reading Current Releases List';
$versionList = explode("\n", $getVersions);
foreach ($versionList as $aV)
{
if ( $aV > $current_version) {
echo '<p>New Update Found: v'.$aV.'</p>';
$found = true;
//Lade Datei herunter, Wenn sie noch nicht vorhanden sind
if ( !is_file( $_ENV['site']['files']['includes-dir'].'lupusgui-'.$aV.'.zip' )) {
echo 'Läd Update herunter...';
$newUpdate = file_get_contents('https://test.musicintime.de/update/lupusgui-'.$aV.'.zip');
if ( !is_dir( $_ENV['site']['files']['includes-dir'].'/update/' ) ) {
mkdir ( $_ENV['site']['files']['includes-dir'].'/update/' );
}
$dlHandler = fopen($_ENV['site']['files']['includes-dir'].'lupusgui-'.$aV.'.zip', 'w');
if ( !fwrite($dlHandler, $newUpdate) ) {
echo '<p>Could not save new update. Operation aborted.</p>'; exit();
}
fclose($dlHandler);
echo '<p>Update Downloaded And Saved</p>';
} else {
echo '<p>Update already downloaded.</p>';
}
if ($_GET['doUpdate'] == true) {
//Öffne die Datei und extrahiere sie
$zipHandle = zip_open($_ENV['site']['files']['includes-dir'].'lupusgui-'.$aV.'.zip');
echo '<ul>';
while ($aF = zip_read($zipHandle) )
{
$thisFileName = zip_entry_name($aF);
$thisFileDir = dirname($thisFileName);
//Fahre fort, wenn es keine Datei ist
if ( substr($thisFileName,-1,1) == '/') continue;
//Erstelle die benötigten Ordner
if ( !is_dir ( $_ENV['site']['files']['server-root'].'/'.$thisFileDir ) )
{
mkdir ( $_ENV['site']['files']['server-root'].'/'.$thisFileDir );
echo '<li>Created Directory '.$thisFileDir.'</li>';
}
//Überschreibe die Dateien
if ( !is_dir($_ENV['site']['files']['server-root'].'/'.$thisFileName) ) {
echo '<li>'.$thisFileName.'...........';
$contents = zip_entry_read($aF, zip_entry_filesize($aF));
$contents = str_replace("\r\n", "\n", $contents);
$updateThis = '';
//Schreibe in upgrade.php Datei
if ( $thisFileName == 'upgrade.php' )
{
$upgradeExec = fopen ('upgrade.php','w');
fwrite($upgradeExec, $contents);
fclose($upgradeExec);
include ('upgrade.php');
unlink('upgrade.php');
echo' EXECUTED</li>';
}
else
{
$updateThis = fopen($_ENV['site']['files']['server-root'].'/'.$thisFileName, 'w');
fwrite($updateThis, $contents);
fclose($updateThis);
unset($contents);
echo' UPDATED</li>';
}
}
}
echo '</ul>';
$updated = TRUE;
}
else echo '<p>Update ready. <a href="?doUpdate=true">» Install Now?</a></p>';
break;
}
}
if ($updated == true)
{
set_setting('site','CMS',$aV);
echo '<p class="success">» CMS Updated to v'.$aV.'</p>';
}
else if ($found != true) echo '<p>» No update is available.</p>';
}
else echo '<p>Could not find latest realeases.</p>';
Allerdings wird mir dieser Error ausgegeben:
Warning: is_dir(): open_basedir restriction in effect. File(/.) is not within the allowed path(s): (/var/www/vhosts/musicintime.de/:/tmp/:/dev/urandom) in /var/www/vhosts/musicintime.de/LupusGUI/include/backend/update.inc.php on line 47
Warning: mkdir(): open_basedir restriction in effect. File(/.) is not within the allowed path(s): (/var/www/vhosts/musicintime.de/:/tmp/:/dev/urandom) in /var/www/vhosts/musicintime.de/LupusGUI/include/backend/update.inc.php on line 49
Created Directory .
test.php...........
Warning: fopen(/test.php): failed to open stream: Permission denied in /var/www/vhosts/musicintime.de/LupusGUI/include/backend/update.inc.php on line 72
Warning: fwrite() expects parameter 1 to be resource, boolean given in /var/www/vhosts/musicintime.de/LupusGUI/include/backend/update.inc.php on line 73
Warning: fclose() expects parameter 1 to be resource, boolean given in /var/www/vhosts/musicintime.de/LupusGUI/include/backend/update.inc.php on line 74
UPDATED
Fatal error: Uncaught Error: Call to undefined function set_setting() in /var/www/vhosts/musicintime.de/LupusGUI/include/backend/update.inc.php:89 Stack trace: #0 /var/www/vhosts/musicintime.de/LupusGUI/backend/update.php(14): require() #1 {main} thrown in /var/www/vhosts/musicintime.de/LupusGUI/include/backend/update.inc.php on line 89