Пример #1
0
 /**
  */
 function Install_Table($table)
 {
     $this->_table_name = $table;
     if (!check_opendb_table($this->_table_name)) {
         $this->doInstallTable();
     }
 }
 function __perform_install_table_batch()
 {
     if (file_exists("./admin/s_site_plugin/sql/" . $this->_job . ".install.class.php")) {
         $classname = "Install_" . $this->_job;
         include_once "./admin/s_site_plugin/sql/" . $this->_job . ".install.class.php";
         $installPlugin = new $classname();
         // this is currently the only type we support.
         if ($installPlugin->getInstallType() == 'Install_Table') {
             if (check_opendb_table($installPlugin->getInstallTable())) {
                 if ($this->_batchlimit > 0) {
                     $fh = @fopen('./admin/s_site_plugin/upload/' . $this->_uploadFile, 'rb');
                     if ($fh !== FALSE) {
                         $installPlugin->setRowRange($this->_completed + 1, $this->_completed + $this->_batchlimit);
                         if (($header_row = fgetcsv($fh, 4096, ",")) !== FALSE) {
                             $installPlugin->_handleRow($header_row);
                         }
                         while (!$installPlugin->isEndRowFound() && ($read_row_r = fgetcsv($fh, 4096, ",")) !== FALSE) {
                             $installPlugin->_handleRow($read_row_r);
                         }
                         fclose($fh);
                         $this->_processed = $installPlugin->getProcessedCount();
                         $this->_completed = $installPlugin->getRowCount();
                     } else {
                         opendb_logger(OPENDB_LOG_ERROR, __FILE__, __FUNCTION__, 'Upload file not accessible');
                         return FALSE;
                     }
                 } else {
                     return FALSE;
                 }
             } else {
                 opendb_logger(OPENDB_LOG_ERROR, __FILE__, __FUNCTION__, 'Plugin table ' . strtoupper($installPlugin->getInstallTable()) . ' does not exist');
                 return FALSE;
             }
         } else {
             return FALSE;
         }
     } else {
         opendb_logger(OPENDB_LOG_ERROR, __FILE__, __FUNCTION__, 'Site Plugin installation maintenance class not found');
         return FALSE;
     }
 }
Пример #3
0
             echo "<p>If you cannot resolve the issue, you can save the configuration file manually.  The contents of the textarea should be saved to  \n\t\t\t\t<code>./include/local.config.php</code>.  Once this is done click <strong>Retry</strong>.";
             echo "<form>";
             echo "<textarea rows=\"12\" cols=\"100\">" . htmlspecialchars($config_file_contents) . "</textarea>";
             echo "</form>";
         }
     }
     echo _theme_footer();
 } else {
     // if the s_opendb_release table does not exist, we need to install it, and populate with
     // a specific version record.
     echo _theme_header("OpenDb " . get_opendb_version() . " Installation", FALSE);
     echo "<h2>Pre Installation</h2>";
     $preinstall_details = NULL;
     $db_version = NULL;
     if (!check_opendb_table('s_opendb_release') || count_opendb_table_rows('s_opendb_release') == 0 || count_opendb_table_columns('s_opendb_release') != 6) {
         if (!check_opendb_table('s_opendb_release') || count_opendb_table_columns('s_opendb_release') != 6) {
             if (exec_install_sql_file('./install/new/s_opendb_release.sql', $errors)) {
                 $preinstall_details[] = 'OpenDb release table created';
             }
         }
         if (is_opendb_partially_installed()) {
             $db_version = install_determine_opendb_database_version();
             if ($db_version !== FALSE) {
                 // we are inserting a placeholder record for whatever the users current version is, so we can proceed with
                 // any upgrades.  Its NULL already, because there are no steps for the old install, but the nominated_version
                 // information will be used by installer for any additional upgrades.
                 if (insert_opendb_release($db_version, 'New Install', NULL) !== FALSE) {
                     $preinstall_details[] = 'Inserted OpenDb release record (Version ' . $db_version . ')';
                 } else {
                     $errors[] = 'Failed to insert OpenDb release record (Version ' . $db_version . ')';
                 }
Пример #4
0
function is_valid_opendb_release_table()
{
    return check_opendb_table('s_opendb_release') && count_opendb_table_columns('s_opendb_release') == 6;
}