本文整理汇总了PHP中Piwik::createTables方法的典型用法代码示例。如果您正苦于以下问题:PHP Piwik::createTables方法的具体用法?PHP Piwik::createTables怎么用?PHP Piwik::createTables使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piwik
的用法示例。
在下文中一共展示了Piwik::createTables方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setUp
/**
* Setup the database and create the base tables for all tests
*/
public function setUp()
{
parent::setUp();
try {
Piwik::createConfigObject();
Piwik_Config::getInstance()->setTestEnvironment();
$dbConfig = Piwik_Config::getInstance()->database;
$dbName = $dbConfig['dbname'];
$dbConfig['dbname'] = null;
Piwik::createDatabaseObject($dbConfig);
Piwik::dropDatabase();
Piwik::createDatabase($dbName);
Piwik::disconnectDatabase();
Piwik::createDatabaseObject();
Piwik::createTables();
Piwik::createLogObject();
Piwik_PluginsManager::getInstance()->loadPlugins(array());
} catch (Exception $e) {
$this->fail("TEST INITIALIZATION FAILED: " . $e->getMessage());
}
include "DataFiles/SearchEngines.php";
include "DataFiles/Languages.php";
include "DataFiles/Countries.php";
include "DataFiles/Currencies.php";
include "DataFiles/LanguageToCountry.php";
}
示例2: setUpBeforeClass
public static function setUpBeforeClass($dbName = false, $createEmptyDatabase = true, $createConfig = true)
{
try {
Piwik::$piwikUrlCache = '';
if ($createConfig) {
self::createTestConfig();
}
if ($dbName === false) {
$dbName = Piwik_Config::getInstance()->database['dbname'];
}
self::connectWithoutDatabase();
if ($createEmptyDatabase) {
Piwik::dropDatabase();
}
Piwik::createDatabase($dbName);
Piwik::disconnectDatabase();
// reconnect once we're sure the database exists
Piwik_Config::getInstance()->database['dbname'] = $dbName;
Piwik::createDatabaseObject();
Piwik::createTables();
Piwik::createLogObject();
Piwik_PluginsManager::getInstance()->loadPlugins(array());
} catch (Exception $e) {
self::fail("TEST INITIALIZATION FAILED: " . $e->getMessage());
}
include "DataFiles/SearchEngines.php";
include "DataFiles/Languages.php";
include "DataFiles/Countries.php";
include "DataFiles/Currencies.php";
include "DataFiles/LanguageToCountry.php";
Piwik::createAccessObject();
Piwik_PostEvent('FrontController.initAuthenticationObject');
// We need to be SU to create websites for tests
Piwik::setUserIsSuperUser();
// Load and install plugins
$pluginsManager = Piwik_PluginsManager::getInstance();
$plugins = $pluginsManager->readPluginsDirectory();
$pluginsManager->loadPlugins($plugins);
if ($createEmptyDatabase) {
$pluginsManager->installLoadedPlugins();
}
$_GET = $_REQUEST = array();
$_SERVER['HTTP_REFERER'] = '';
// Make sure translations are loaded to check messages in English
Piwik_Translate::getInstance()->loadEnglishTranslation();
Piwik_LanguagesManager_API::getInstance()->setLanguageForUser('superUserLogin', 'en');
// List of Modules, or Module.Method that should not be called as part of the XML output compare
// Usually these modules either return random changing data, or are already tested in specific unit tests.
self::setApiNotToCall(self::$defaultApiNotToCall);
self::setApiToCall(array());
}
示例3: __construct
function __construct($title = '')
{
parent::__construct($title);
print "The test class extends Test_Database: the test Piwik database is created once in the constructor, and all tables are truncated at the end of EACH unit test method.<br>";
Piwik::createConfigObject();
Piwik::createDatabaseObject();
Zend_Registry::get('config')->setTestEnvironment();
Zend_Registry::get('config')->disableSavingConfigurationFileUpdates();
Piwik::createLogObject();
Piwik::dropDatabase();
Piwik::createDatabase();
Piwik::disconnectDatabase();
Piwik::createDatabaseObject();
Piwik::createTables();
}
示例4: __construct
function __construct($title = '')
{
parent::__construct($title);
try {
Piwik::createConfigObject();
Piwik_Config::getInstance()->setTestEnvironment();
Piwik::createDatabaseObject();
Piwik::createLogObject();
Piwik::dropDatabase();
Piwik::createDatabase();
Piwik::disconnectDatabase();
Piwik::createDatabaseObject();
Piwik::createTables();
Piwik_PluginsManager::getInstance()->installLoadedPlugins();
} catch (Exception $e) {
echo $e->getMessage();
echo "<br/><b>TEST INITIALIZATION FAILED!";
throw $e;
}
}
示例5: tablesCreation
/**
* Installation Step 5: Table Creation
*/
function tablesCreation()
{
$this->checkPreviousStepIsValid( __FUNCTION__ );
$view = new Piwik_Installation_View(
$this->pathView . 'tablesCreation.tpl',
$this->getInstallationSteps(),
__FUNCTION__
);
$this->skipThisStep( __FUNCTION__ );
$this->createDbFromSessionInformation();
if(Piwik_Common::getRequestVar('deleteTables', 0, 'int') == 1)
{
Piwik::dropTables();
$view->existingTablesDeleted = true;
// when the user decides to drop the tables then we dont skip the next steps anymore
// workaround ZF-1743
$tmp = $this->session->skipThisStep;
$tmp['firstWebsiteSetup'] = false;
$tmp['displayJavascriptCode'] = false;
$this->session->skipThisStep = $tmp;
}
$tablesInstalled = Piwik::getTablesInstalled();
$tablesToInstall = Piwik::getTablesNames();
$view->tablesInstalled = '';
if(count($tablesInstalled) > 0)
{
// we have existing tables
$view->tablesInstalled = implode(', ', $tablesInstalled);
$view->someTablesInstalled = true;
$minimumCountPiwikTables = 18;
$baseTablesInstalled = preg_grep('/archive_numeric|archive_blob/', $tablesInstalled, PREG_GREP_INVERT);
Piwik::createAccessObject();
Piwik::setUserIsSuperUser();
if(count($baseTablesInstalled) >= $minimumCountPiwikTables &&
count(Piwik_SitesManager_API::getInstance()->getAllSitesId()) > 0 &&
count(Piwik_UsersManager_API::getInstance()->getUsers()) > 0)
{
$view->showReuseExistingTables = true;
// when the user reuses the same tables we skip the website creation step
// workaround ZF-1743
$tmp = $this->session->skipThisStep;
$tmp['firstWebsiteSetup'] = true;
$tmp['displayJavascriptCode'] = true;
$this->session->skipThisStep = $tmp;
}
}
else
{
Piwik::createTables();
Piwik::createAnonymousUser();
$updater = new Piwik_Updater();
$updater->recordComponentSuccessfullyUpdated('core', Piwik_Version::VERSION);
$view->tablesCreated = true;
$view->showNextStep = true;
}
$this->session->currentStepDone = __FUNCTION__;
echo $view->render();
}
示例6: tablesCreation
function tablesCreation()
{
$this->checkPreviousStepIsValid(__FUNCTION__);
$view = new Piwik_Installation_View($this->pathView . 'tablesCreation.tpl', $this->getInstallationSteps(), __FUNCTION__);
$session = new Zend_Session_Namespace("Installation");
$this->skipThisStep(__FUNCTION__);
$this->createDbFromSessionInformation();
if (Piwik_Common::getRequestVar('deleteTables', 0, 'int') == 1) {
Piwik::dropTables();
$view->existingTablesDeleted = true;
// when the user decides to drop the tables then we dont skip the next steps anymore
$session->skipThisStep['firstWebsiteSetup'] = false;
$session->skipThisStep['displayJavascriptCode'] = false;
}
$tablesInstalled = Piwik::getTablesInstalled();
$tablesToInstall = Piwik::getTablesNames();
$view->tablesInstalled = '';
if (count($tablesInstalled) > 0) {
$view->tablesInstalled = implode(", ", $tablesInstalled);
$view->someTablesInstalled = true;
$minimumCountPiwikTables = 14;
if (count($tablesInstalled) >= $minimumCountPiwikTables) {
$view->showReuseExistingTables = true;
// when the user reuses the same tables we skip the website creation step
$session->skipThisStep['firstWebsiteSetup'] = true;
$session->skipThisStep['displayJavascriptCode'] = true;
}
} else {
Piwik::createTables();
Piwik::createAnonymousUser();
require_once "Updater.php";
$updater = new Piwik_Updater();
$updater->recordComponentSuccessfullyUpdated('core', Piwik_Version::VERSION);
$view->tablesCreated = true;
$view->showNextStep = true;
}
if (isset($session->databaseCreated) && $session->databaseCreated === true) {
$view->databaseName = $session->db_infos['dbname'];
$view->databaseCreated = true;
unset($session->databaseCreated);
}
$session->currentStepDone = __FUNCTION__;
echo $view->render();
}