Esempio 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);
     }
 }
Esempio 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);
     }
 }
Esempio 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}");
    }
Esempio 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);
    }
}
Esempio n. 5
0
 */
global $prefs, $tikilib;
if (strpos($_SERVER['SCRIPT_NAME'], basename(__FILE__)) !== false) {
    header('location: index.php');
    exit;
}
if (version_compare(PHP_VERSION, '5.3.0', '<')) {
    header('location: tiki-install.php');
    exit;
}
// Be sure that the user is not already defined by PHP on hosts that still have the php.ini config "register_globals = On"
unset($user);
require_once 'lib/setup/third_party.php';
// Enable Versioning
include_once 'lib/setup/twversion.class.php';
$TWV = new TWVersion();
$num_queries = 0;
$elapsed_in_db = 0.0;
$server_load = '';
$area = 'tiki';
$crumbs = array();
require_once 'lib/setup/tikisetup.class.php';
require_once 'lib/setup/timer.class.php';
$tiki_timer = new timer();
$tiki_timer->start();
require_once 'tiki-setup_base.php';
// Attempt setting locales. This code is just a start, locales should be set per-user.
// Also, different operating systems use different locale strings. en_US.utf8 is valid on POSIX systems, maybe not on Windows, feel free to add alternative locale strings.
setlocale(LC_ALL, '');
// Attempt changing the locale to the system default.
// Since the system default may not be UTF-8 but we may be dealing with multilingual content, attempt ensuring the collations are intelligent by forcing a general UTF-8 collation.
                            if ($most_recent == false) {
                                $result[$entry] = tra('This file is from another Tikiwiki version: ') . implode(tra(' or '), $is_tikiver);
                            }
                        }
                    }
                }
            }
        }
    }
    $d->close();
}
// if check installation is pressed, walk through all files and compute md5 sums
if (isset($_REQUEST['check_files'])) {
    global $tiki_versions;
    require_once 'lib/setup/twversion.class.php';
    $version = new TWVersion();
    $tiki_versions = $version->tikiVersions();
    $result = array();
    md5_check_dir(".", $result);
    // echo "<pre>"; print_r($tikimd5);echo "</pre><br />";
    // echo "<pre>"; print_r($result);echo "</pre><br />";
    $smarty->assign('filecheck', true);
    $smarty->assign_by_ref('tikifiles', $result);
}
define('S_ISUID', '2048');
define('S_ISGID', '1024');
define('S_ISVTX', '512');
define('S_IRUSR', '256');
define('S_IWUSR', '128');
define('S_IXUSR', '64');
define('S_IRGRP', '32');