} $database = DB_NAME; $count = 0; $list = $pdo->query("SELECT TABLE_NAME, COLUMN_NAME, UPPER(COLUMN_TYPE), EXTRA FROM information_schema.columns WHERE table_schema = '" . $database . "'"); if (count($list) == 0) { echo $pdo->log->info("No table columns to rename"); } else { foreach ($list as $column) { if ($column['column_name'] !== strtolower($column['column_name'])) { echo $pdo->log->header("Renaming Table " . $column['table_name'] . " Column " . $column['column_name']); if (isset($column['extra'])) { $extra = strtoupper($column['extra']); } else { $extra = ''; } $pdo->queryDirect("ALTER TABLE " . $column['table_name'] . " CHANGE " . $column['column_name'] . " " . strtolower($column['column_name']) . " " . $column['upper(column_type)'] . " " . $extra); $count++; } if (strtolower($column['column_name']) === 'id' && strtolower($column['extra']) !== 'auto_increment') { echo $pdo->log->header("Renaming Table " . $column['table_name'] . " Column " . $column['column_name']); $extra = 'AUTO_INCREMENT'; if ($column['table_name'] != "releases_se") { $placeholder = $pdo->queryDirect("SELECT MAX(id) FROM " . $column['table_name']); $pdo->queryDirect("ALTER IGNORE TABLE " . $column['table_name'] . " CHANGE " . $column['column_name'] . " " . strtolower($column['column_name']) . " " . $column['upper(column_type)'] . " " . $extra); $pdo->queryDirect("ALTER IGNORE TABLE " . $column['table_name'] . " AUTO_INCREMENT = " . $placeholder + 1); $count++; } } } } if ($count == 0) {
<?php // // Script will dump out all nfos in the system into a folder based on the date posted to usenet ./YYYYMMDD/release.nfo // Its not very efficient to pull them all out, should really work out which day you need and go from there. // require_once dirname(__FILE__) . '/../../www/config.php'; $db = new \newznab\db\Settings(); $res = $db->queryDirect("select releases.searchname, releases.postdate, uncompress(releasenfo.nfo) as nfo from releases inner join releasenfo on releases.ID = releasenfo.releaseID and releasenfo.nfo is not null order by postdate"); while ($row = $db->getAssocArray($res)) { $dir = date("Ymd", strtotime($row["postdate"])); if (!file_exists($dir)) { mkdir($dir); } $filename = $dir . "/" . safeFilename($row["searchname"]) . ".nfo"; if (!file_exists($filename)) { $fh = fopen($filename, 'w'); fwrite($fh, \newznab\utility\Utility::cp437toUTF($row["nfo"])); fclose($fh); } }