Ejemplo n.º 1
0
 function update()
 {
     // Mark InnoDB usage for updates
     if (strcasecmp($this->getCurrentEngine(), "InnoDB") == 0) {
         $this->useInnoDB = true;
     }
     if (!$this->tableExists('tiki_schema')) {
         // DB too old to handle auto update
         if (file_exists(dirname(__FILE__) . '/../db/custom_upgrade.sql')) {
             $this->runFile(dirname(__FILE__) . '/../db/custom_upgrade.sql');
         } else {
             // If 1.9
             if (!$this->tableExists('tiki_minichat')) {
                 $this->runFile(dirname(__FILE__) . '/../db/tiki_1.9to2.0.sql');
             }
             $this->runFile(dirname(__FILE__) . '/../db/tiki_2.0to3.0.sql');
         }
     }
     $TWV = new TWVersion();
     $dbversion_tiki = $TWV->getBaseVersion();
     $secdb = dirname(__FILE__) . '/../db/tiki-secdb_' . $dbversion_tiki . '_mysql.sql';
     if (file_exists($secdb)) {
         $this->runFile($secdb);
     }
     $patches = $this->patches;
     foreach ($patches as $patch) {
         $this->installPatch($patch);
     }
     foreach ($this->scripts as $script) {
         $this->runScript($script);
     }
 }
Ejemplo n.º 2
0
 function update()
 {
     // Mark InnoDB usage for updates
     if (strcasecmp($this->getCurrentEngine(), "InnoDB") == 0) {
         $this->useInnoDB = true;
     }
     if (!$this->tableExists('tiki_schema')) {
         // DB too old to handle auto update
         if (file_exists(dirname(__FILE__) . '/../db/custom_upgrade.sql')) {
             $this->runFile(dirname(__FILE__) . '/../db/custom_upgrade.sql');
         } else {
             // If 1.9
             if (!$this->tableExists('tiki_minichat')) {
                 $this->runFile(dirname(__FILE__) . '/../db/tiki_1.9to2.0.sql');
             }
             $this->runFile(dirname(__FILE__) . '/../db/tiki_2.0to3.0.sql');
         }
     }
     $TWV = new TWVersion();
     $dbversion_tiki = $TWV->getBaseVersion();
     // If a Mysql data file exists, use that. Very fast
     //	If data file is missing or the batch loader is not available, use the single insert method
     $secdb = dirname(__FILE__) . '/../db/tiki-secdb_' . $dbversion_tiki . '_mysql.sql';
     $secdbData = dirname(__FILE__) . '/../db/tiki-secdb_' . $dbversion_tiki . '_mysql.data';
     if (file_exists($secdbData)) {
         // A MySQL datafile exists
         $truncateTable = true;
         $rc = $this->runDataFile($secdbData, 'tiki_secdb', $truncateTable);
         if ($rc == false) {
             // The batch loader failed
             if (file_exists($secdb)) {
                 // Run single inserts
                 $this->runFile($secdb);
             }
         }
     } else {
         if (file_exists($secdb)) {
             // Run single inserts
             $this->runFile($secdb);
         }
     }
     $patches = $this->patches;
     foreach ($patches as $patch) {
         $this->installPatch($patch);
     }
     foreach ($this->scripts as $script) {
         $this->runScript($script);
     }
 }
Ejemplo n.º 3
0
    protected function execute(InputInterface $input, OutputInterface $output)
    {
        $username = $input->getArgument('username');
        $password = $input->getArgument('password');
        $database = $input->getArgument('database');
        if (!($hostname = $input->getOption('host', 'localhost'))) {
            $hostname = 'localhost';
        }
        $twversion = new \TWVersion();
        $version = $twversion->getBaseVersion();
        $export_username = var_export($username, true);
        $export_password = var_export($password, true);
        $export_database = var_export($database, true);
        $export_hostname = var_export($hostname, true);
        $export_version = var_export($version, true);
        $out = <<<LOCALPHP
<?php
\$db_tiki='mysql';
\$dbversion_tiki={$export_version};
\$host_tiki={$export_hostname};
\$user_tiki={$export_username};
\$pass_tiki={$export_password};
\$dbs_tiki={$export_database};
\$client_charset='utf8';
// If you experience text encoding issues after updating (e.g. apostrophes etc showing up as strange characters)
// \$client_charset='latin1';
// \$client_charset='utf8';
// See http://tiki.org/ReleaseNotes5.0#Known_Issues and http://doc.tiki.org/Understanding+Encoding for more info

// If your php installation does not not have pdo extension
// \$api_tiki = 'adodb';

// Want configurations managed at the system level or restrict some preferences? http://doc.tiki.org/System+Configuration
// \$system_configuration_file = '/etc/tiki.ini';
// \$system_configuration_identifier = 'example.com';

LOCALPHP;
        $local_php = \TikiInit::getCredentialsFile();
        file_put_contents($local_php, $out);
        $output->writeln("Wrote {$local_php}");
    }
Ejemplo n.º 4
0
/**
 * @param $dbb_tiki
 * @param $host_tiki
 * @param $user_tiki
 * @param $pass_tiki
 * @param $dbs_tiki
 * @param string $client_charset
 * @param string $api_tiki
 * @param string $dbversion_tiki
 */
function write_local_php($dbb_tiki, $host_tiki, $user_tiki, $pass_tiki, $dbs_tiki, $client_charset = '', $api_tiki = '', $dbversion_tiki = 'current')
{
    global $local;
    global $db_tiki;
    if ($dbs_tiki && $user_tiki) {
        $db_tiki = addslashes($dbb_tiki);
        $host_tiki = addslashes($host_tiki);
        $user_tiki = addslashes($user_tiki);
        $pass_tiki = addslashes($pass_tiki);
        $dbs_tiki = addslashes($dbs_tiki);
        $fw = fopen($local, 'w');
        $filetowrite = "<?php\n";
        $filetowrite .= "\$db_tiki='" . $db_tiki . "';\n";
        if ($dbversion_tiki == 'current') {
            require_once 'lib/setup/twversion.class.php';
            $twversion = new TWVersion();
            $dbversion_tiki = $twversion->getBaseVersion();
        }
        $filetowrite .= "\$dbversion_tiki='" . $dbversion_tiki . "';\n";
        $filetowrite .= "\$host_tiki='" . $host_tiki . "';\n";
        $filetowrite .= "\$user_tiki='" . $user_tiki . "';\n";
        $filetowrite .= "\$pass_tiki='" . $pass_tiki . "';\n";
        $filetowrite .= "\$dbs_tiki='" . $dbs_tiki . "';\n";
        if (!empty($api_tiki)) {
            $filetowrite .= "\$api_tiki='" . $api_tiki . "';\n";
        }
        if (!empty($client_charset)) {
            $filetowrite .= "\$client_charset='{$client_charset}';\n";
        }
        $filetowrite .= "// If you experience text encoding issues after updating (e.g. apostrophes etc showing up as strange characters) \n";
        $filetowrite .= "// \$client_charset='latin1';\n";
        $filetowrite .= "// \$client_charset='utf8';\n";
        $filetowrite .= "// See http://tiki.org/ReleaseNotes5.0#Known_Issues and http://doc.tiki.org/Understanding+Encoding for more info\n\n";
        $filetowrite .= "// If your php installation does not not have pdo extension\n";
        $filetowrite .= "// \$api_tiki = 'adodb';\n\n";
        $filetowrite .= "// Want configurations managed at the system level or restrict some preferences? http://doc.tiki.org/System+Configuration\n";
        $filetowrite .= "// \$system_configuration_file = '/etc/tiki.ini';\n";
        $filetowrite .= "// \$system_configuration_identifier = 'example.com';\n\n";
        fwrite($fw, $filetowrite);
        fclose($fw);
    }
}