Example #1
0
    if (!$username) {
        print "error: please specify username.\n";
        return;
    }
    if (!is_file($filename)) {
        print "error: input filename ({$filename}) doesn't exist.\n";
        return;
    }
    _debug("importing {$filename} for user {$username}...\n");
    $result = db_query($link, "SELECT id FROM ttrss_users WHERE login = '******'");
    if (db_num_rows($result) == 0) {
        print "error: could not find user {$username}.\n";
        return;
    }
    $owner_uid = db_fetch_result($result, 0, "id");
    perform_data_import($link, $filename, $owner_uid);
}
if (in_array("-indexes", $op)) {
    _debug("PLEASE BACKUP YOUR DATABASE BEFORE PROCEEDING!");
    _debug("Type 'yes' to continue.");
    if (read_stdin() != 'yes') {
        exit;
    }
    _debug("clearing existing indexes...");
    if (DB_TYPE == "pgsql") {
        $result = db_query($link, "SELECT relname FROM\n\t\t\t\tpg_catalog.pg_class WHERE relname LIKE 'ttrss_%'\n\t\t\t\t\tAND relname NOT LIKE '%_pkey'\n\t\t\t\tAND relkind = 'i'");
    } else {
        $result = db_query($link, "SELECT index_name,table_name FROM\n\t\t\t\tinformation_schema.statistics WHERE index_name LIKE 'ttrss_%'");
    }
    while ($line = db_fetch_assoc($result)) {
        if (DB_TYPE == "pgsql") {
Example #2
0
 function dataImport()
 {
     header("Content-Type: text/html");
     # required for iframe
     print "<div style='text-align : center'>";
     if (is_file($_FILES['export_file']['tmp_name'])) {
         perform_data_import($this->link, $_FILES['export_file']['tmp_name'], $_SESSION['uid']);
     } else {
         print "<p>" . T_sprintf("Could not upload file. You might need to adjust upload_max_filesize\n\t\t\t\tin PHP.ini (current value = %s)", ini_get("upload_max_filesize")) . " or use CLI import tool.</p>";
     }
     print "<button dojoType=\"dijit.form.Button\"\n\t\t\tonclick=\"dijit.byId('dataImportDlg').hide()\">" . __('Close this window') . "</button>";
     print "</div>";
 }