예제 #1
0
function convertTables($text)
{
    $lines = explode("\n", $text);
    $innertable = 0;
    $innertabledata = array();
    foreach ($lines as $line) {
        //echo "<pre>".++$i.": ".htmlspecialchars($line)."</pre>";
        $line = str_replace("position:relative", "", $line);
        $line = str_replace("position:absolute", "", $line);
        if (substr($line, 0, 2) == '{|') {
            // inner table
            //echo "<p>beginning inner table #$innertable</p>";
            $innertable++;
        }
        $innertabledata[$innertable] .= $line . "\n";
        if ($innertable) {
            // we're inside
            if (substr($line, 0, 2) == '|}') {
                $innertableconverted = convertTable($innertabledata[$innertable]);
                $innertabledata[$innertable] = "";
                $innertable--;
                $innertabledata[$innertable] .= $innertableconverted . "\n";
            }
        }
    }
    return $innertabledata[0];
}
예제 #2
0
//  Other                               0                       3050/3000
//      3D                                      2060/2000       2050/2000
//      BluRay                          2050/2000       2060/2000
//      Books                           7000/null       8000/null
//      Other                           6070/6000       6050/6000
//      Other                           8010/8000       8050/8000
convertTable($pdo, $nZEDB_schema, "releases", "INSERT INTO " . $nZEDB_schema . ".releases (adddate, anidbid, bookinfoid, categoryid, comments, completion, consoleinfoid, episode, fromname, grabs, group_id, guid, haspreview, id, imdbid, musicinfoid, name, passwordstatus, postdate, rageid, rarinnerfilecount, searchname, season, seriesfull, size, totalpart, tvairdate, tvtitle, nzb_guid) " . "SELECT adddate, anidbID, bookinfoID, case categoryID when 7030 then 8020 when 7020 then 8010 when 7010 then 8030 when 6050 then 6070 when 2060 then 2050 when 2050 then 2060 when 7000 then 8000 when 6070 then 6050 when 8010 then 8050 else categoryID end, comments, completion, consoleinfoID, episode, fromname, grabs, group_id, guid, haspreview, ID, imdbID, musicinfoID, name, passwordstatus, postdate, rageID, rarinnerfilecount, searchname, season, seriesfull, size, totalpart, tvairdate, tvtitle, UNHEX(gid) FROM " . $nn_schema . ".releases", $runQueries);
convertTable($pdo, $nZEDB_schema, "release_subtitles", "INSERT INTO " . $nZEDB_schema . ".release_subtitles (releaseid, subsid, subslanguage) " . "SELECT releaseID, subsID, subslanguage FROM " . $nn_schema . ".releasesubs", $runQueries);
// You lose (definition).
convertTable($pdo, $nZEDB_schema, "video_data", "INSERT INTO " . $nZEDB_schema . ".video_data (containerformat,overallbitrate,releaseid,videoaspect,videocodec,videoduration,videoformat,videoframerate,videoheight,videolibrary,videowidth) " . "SELECT containerformat,overallbitrate,releaseID,videoaspect,videocodec,videoduration,videoformat,videoframerate, videoheight, videolibrary, videowidth FROM " . $nn_schema . ".releasevideo group by releaseID", $runQueries);
echo "Skipping rolexcat table: Not in nZEDb\n";
echo "Skipping sites table: You must manually update your site settings (siteseed is not used)\n";
echo "Skipping sphinx table: Not in nZEDb\n";
echo "Skipping spotnabsource table: Not in nZEDb\n";
echo "Skipping thetvdb table: Not in nZEDb\n";
convertTable($pdo, $nZEDB_schema, "tvrage_titles", "INSERT INTO " . $nZEDB_schema . ".tvrage_titles (country, createddate, description, genre, id, imgdata, nextdate, nextinfo, prevdate, previnfo, rageid, releasetitle, tvdbid) " . "SELECT country, createddate, description, genre, ID, imgdata, nextdate, nextinfo, prevdate, previnfo, rageID, releasetitle, tvdbID FROM " . $nn_schema . ".tvrage group by releasetitle", $runQueries);
convertTable($pdo, $nZEDB_schema, "upcoming_releases", "INSERT INTO " . $nZEDB_schema . ".upcoming_releases (source, typeid, info, updateddate) " . "SELECT source, typeID, info, updateddate FROM " . $nn_schema . ".upcoming", $runQueries);
convertTable($pdo, $nZEDB_schema, "users_releases", "INSERT INTO " . $nZEDB_schema . ".users_releases (user_id, releaseid, createddate) " . "SELECT userID, releaseID, createddate FROM " . $nn_schema . ".usercart", $runQueries);
// You lose (hosthash, releaseID).
convertTable($pdo, $nZEDB_schema, "user_downloads", "INSERT INTO " . $nZEDB_schema . ".user_downloads (id, timestamp, user_id) " . "SELECT ID, timestamp, userID FROM " . $nn_schema . ".userdownloads", $runQueries);
convertTable($pdo, $nZEDB_schema, "user_excluded_categories", "INSERT INTO " . $nZEDB_schema . ".user_excluded_categories (user_id, categoryid, createddate) " . "SELECT userID, categoryID, createddate FROM " . $nn_schema . ".userexcat", $runQueries);
convertTable($pdo, $nZEDB_schema, "invitations", "INSERT INTO " . $nZEDB_schema . ".invitations (guid, user_id, createddate) " . "SELECT guid, userID, createddate FROM " . $nn_schema . ".userinvite", $runQueries);
convertTable($pdo, $nZEDB_schema, "user_movies", "INSERT INTO " . $nZEDB_schema . ".user_movies (user_id, imdbid, categoryid, createddate) " . "SELECT userID, imdbID, categoryID, createddate FROM " . $nn_schema . ".usermovies", $runQueries);
// You lose (hosthash).
convertTable($pdo, $nZEDB_schema, "user_requests", "INSERT INTO " . $nZEDB_schema . ".user_requests (id, request, timestamp, user_id) " . "SELECT ID, request, timestamp, userID FROM " . $nn_schema . ".userrequests", $runQueries);
// You lose (canpre).
convertTable($pdo, $nZEDB_schema, "user_roles", "INSERT IGNORE INTO " . $nZEDB_schema . ".user_roles (apirequests, canpreview, defaultinvites, downloadrequests, id, isdefault, name) " . "SELECT apirequests, canpreview, defaultinvites, downloadrequests, ID, isdefault, name FROM " . $nn_schema . ".userroles", $runQueries);
// You lose (kindleid, notes, rolechangedate, nzbvortex_api_key, nzbvortex_server_url, siteseed; and password IS reset).
convertTable($pdo, $nZEDB_schema, "users", "INSERT INTO " . $nZEDB_schema . ".users (apiaccess, bookview, consoleview, createddate, email, grabs, host, id, invitedby, invites, lastlogin, movieview, musicview, password, resetguid, role, rsstoken, sabapikey, sabapikeytype, sabpriority, saburl, username) " . "SELECT apiaccess, bookview, consoleview, createddate, email, grabs, host, ID, invitedby, invites, lastlogin, movieview, musicview, NULL, resetguid, role, rsstoken, sabapikey, sabapikeytype, sabpriority, saburl, username FROM " . $nn_schema . ".users", $runQueries);
convertTable($pdo, $nZEDB_schema, "user_series", "INSERT INTO " . $nZEDB_schema . ".user_series (user_id, rageid, categoryid, createddate) " . "SELECT userID, rageID, categoryID, createddate FROM " . $nn_schema . ".userseries", $runQueries);
exit("Due to some issues moving roles we've used INSERT IGNORE... Please check your user roles in your nZEDb install\n" . "You now need to run copy_from_newznab.php to copy nzbs, covers, previews, set the nzbstatus and nzb path level\n\n" . "DO NOT run update_releases.php before running copy_from_newznab.php, you will have to start over.\n");