<?php set_include_path(realpath(dirname(__FILE__) . '/../vendor/zendframework/zendframework1/library')); require_once 'Zend/Db/Adapter/Pdo/Mysql.php'; $db = new Zend_Db_Adapter_Pdo_Mysql(array('host' => 'localhost', 'charset' => 'utf8', 'dbname' => 'hello_world', 'username' => 'benchmarkdbuser', 'password' => 'benchmarkdbpass')); $db->exec('DROP TABLE IF EXISTS `World`;'); $db->exec('CREATE TABLE `World` ( `id` int(11) NOT NULL, `randomNumber` int(11) NOT NULL, PRIMARY KEY (`id`) ) ENGINE=InnoDB DEFAULT CHARSET=utf8;'); for ($i = 1; $i <= 10000; $i++) { $db->insert('World', array('id' => $i, 'randomNumber' => $i)); }
$db->getConnection(); $db->getConnection()->exec("SET NAMES UTF8"); $db->getConnection()->exec("SET storage_engine=InnoDB;"); // insert db dump //$db = Pimcore_Resource::get(); $mysqlInstallScript = file_get_contents(PIMCORE_PATH . "/modules/install/mysql/install.sql"); // remove comments in SQL script $mysqlInstallScript = preg_replace("/\\s*(?!<\")\\/\\*[^\\*]+\\*\\/(?!\")\\s*/", "", $mysqlInstallScript); // get every command as single part $mysqlInstallScripts = explode(";", $mysqlInstallScript); // execute every script with a separate call, otherwise this will end in a PDO_Exception "unbufferd queries, ..." foreach ($mysqlInstallScripts as $m) { $sql = trim($m); if (strlen($sql) > 0) { $sql .= ";"; $db->exec($m); } } // insert data into database $db->insert("assets", array("id" => 1, "parentId" => 0, "type" => "folder", "filename" => "", "path" => "/", "creationDate" => time(), "modificationDate" => time(), "userOwner" => 1, "userModification" => 1)); $db->insert("documents", array("id" => 1, "parentId" => 0, "type" => "page", "key" => "", "path" => "/", "index" => 999999, "published" => 1, "creationDate" => time(), "modificationDate" => time(), "userOwner" => 1, "userModification" => 1)); $db->insert("documents_page", array("id" => 1, "controller" => "", "action" => "", "template" => "", "title" => "", "description" => "", "keywords" => "")); $db->insert("objects", array("o_id" => 1, "o_parentId" => 0, "o_type" => "folder", "o_key" => "", "o_path" => "/", "o_index" => 999999, "o_published" => 1, "o_creationDate" => time(), "o_modificationDate" => time(), "o_userOwner" => 1, "o_userModification" => 1)); $userPermissions = array(array("key" => "assets", "translation" => "permission_assets"), array("key" => "classes", "translation" => "permission_classes"), array("key" => "clear_cache", "translation" => "permission_clear_cache"), array("key" => "clear_temp_files", "translation" => "permission_clear_temp_files"), array("key" => "document_types", "translation" => "permission_document_types"), array("key" => "documents", "translation" => "permission_documents"), array("key" => "objects", "translation" => "permission_objects"), array("key" => "plugins", "translation" => "permission_plugins"), array("key" => "predefined_properties", "translation" => "permission_predefined_properties"), array("key" => "routes", "translation" => "permission_routes"), array("key" => "seemode", "translation" => "permission_seemode"), array("key" => "system_settings", "translation" => "permission_system_settings"), array("key" => "thumbnails", "translation" => "permission_thumbnails"), array("key" => "translations", "translation" => "permission_translations"), array("key" => "users", "translation" => "permission_users"), array("key" => "update", "translation" => "permissions_update"), array("key" => "redirects", "translation" => "permissions_redirects"), array("key" => "glossary", "translation" => "permissions_glossary"), array("key" => "reports", "translation" => "permissions_reports_marketing")); foreach ($userPermissions as $up) { $db->insert("users_permission_definitions", $up); } } // complete the pimcore starup tasks (config, framework, modules, plugins ...) Pimcore::initConfiguration(); sleep(4);