mirror of
https://github.com/NNTmux/newznab-tmux.git
synced 2026-08-29 17:28:55 +00:00
Move files to logical positions, no more copying of files.
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
<?php
|
||||
|
||||
require_once("config.php");
|
||||
|
||||
use newznab\db\Settings;
|
||||
|
||||
$s = new Sites();
|
||||
$site = $s->get();
|
||||
$patches = $s->getUnappliedPatches($site);
|
||||
|
||||
if (count($patches) == 0)
|
||||
echo "Patchn : No patches required applying. At version ".$site->dbversion."\n";
|
||||
else
|
||||
{
|
||||
echo "Patchn : Database at version ".$site->dbversion."\n";
|
||||
|
||||
foreach ($patches as $patch)
|
||||
{
|
||||
echo "Patchn : Executing patch ".basename($patch)."\n";
|
||||
|
||||
$db = new Settings();
|
||||
$rows = $db->query("select * from settings");
|
||||
|
||||
$dbData = file_get_contents($patch);
|
||||
//fix to remove BOM in UTF8 files
|
||||
$bom = pack("CCC", 0xef, 0xbb, 0xbf);
|
||||
if (0 == strncmp($dbData, $bom, 3)) {
|
||||
$dbData = substr($dbData, 3);
|
||||
}
|
||||
$queries = explode(";", $dbData);
|
||||
$queries = array_map("trim", $queries);
|
||||
foreach($queries as $q) {
|
||||
if (strlen($q) > 0)
|
||||
$db->exec($q);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user