本文整理汇总了PHP中R::debug方法的典型用法代码示例。如果您正苦于以下问题:PHP R::debug方法的具体用法?PHP R::debug怎么用?PHP R::debug使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类R
的用法示例。
在下文中一共展示了R::debug方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setup
/**
* Sets up the database connection.
* @param $dsn The datasource name. See: <a href="http://nl3.php.net/manual/en/pdo.construct.php">http://nl3.php.net/manual/en/pdo.construct.php</a>
* @code
* "sqlite:database.txt"
* "mysql:host=localhost;dbname=oodb"
* "pgsql:host=localhost;dbname=oodb"
* @endcode
* @param $username The database user's login username.
* @param $password The database user's login password.
*/
public static function setup($dsn, $username, $password)
{
assert('is_string($dsn) && $dsn != ""');
assert('$username == null || is_string($username) && $username != ""');
assert('$password == null || is_string($password)');
assert('!self::isSetup()');
try {
R::setup($dsn, $username, $password);
R::$redbean->addEventListener("update", new RedBeanBeforeUpdateHintManager(R::$toolbox));
if (SHOW_QUERY_DATA) {
Yii::app()->performance->setRedBeanQueryLogger(ZurmoRedBeanPluginQueryLogger::getInstanceAndAttach(R::$adapter));
}
if (defined('REDBEAN_DEBUG_TO_FILE') && REDBEAN_DEBUG_TO_FILE) {
$queryLoggerComponent = Yii::createComponent(array('class' => 'application.core.models.ZurmoRedBeanQueryFileLogger'));
$queryLoggerComponent->init();
Yii::app()->setComponent('queryFileLogger', $queryLoggerComponent);
R::debug(true, Yii::app()->queryFileLogger);
} else {
R::debug(defined('REDBEAN_DEBUG') && REDBEAN_DEBUG);
}
self::$isSetup = true;
self::$databaseType = substr($dsn, 0, strpos($dsn, ':'));
} catch (Exception $e) {
self::close();
throw $e;
}
}
示例2: __construct
/**
* Construct a new database object.
* @param $settings
*/
public function __construct($settings)
{
$this->database = DatabaseManager::connect($settings["host"], $settings["port"], $settings["user"], $settings["pass"], $settings["name"], isset($settings["utf8"]) ? $settings["utf8"] : true);
// Debug
global $settings;
R::debug($settings["development"]);
}
示例3: __construct
function __construct()
{
R::setup('mysql:host=localhost;dbname=Test', 'root', 'mysqladmin');
//R::freeze( TRUE );
// R::startLogging(); //start logging
//turns debugging ON
R::debug(FALSE);
}
示例4: init_db
public static function init_db()
{
// load database system (redbean)
require_once "system/libraries/rb.php";
$connection_string = 'mysql:dbname=' . DB_NAME . ';host=' . DB_HOST;
R::setup($connection_string, DB_USER, DB_PASSWORD);
R::debug(true);
}
示例5: index
public function index()
{
$this->load->library('rb/rb');
R::debug(true);
$post = R::dispense('post');
$post->title = 'Lorem ipsum dolor sit amet';
$post->content = 'Consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.';
R::store($post);
}
示例6: setup
public static function setup()
{
self::init();
self::$dbh = new PDO('mysql:host=' . self::$server . ';dbname=' . self::$databasename . ';', self::$username, self::$password);
self::$dbh->query('SET NAMES utf8');
R::setup(self::$dbh);
R::debug(true, 1);
R::freeze(true);
// self::$logsrv = new SystemlogsService();
self::$queryLogger = R::getDatabaseAdapter()->getDatabase()->getLogger();
}
示例7: createService
/**
* @param ServiceLocatorInterface $serviceLocator
* @return R
*/
public function createService(ServiceLocatorInterface $serviceLocator)
{
$rjhRedbeanService = new R();
$config = $serviceLocator->get('config');
$rjhRedbeanConfig = $config['rjhredbean'];
$connection = $rjhRedbeanConfig['connection'];
$dsn = $connection['dsn'];
$user = $connection['user'];
$password = $connection['password'];
$rjhRedbeanService->setup($dsn, $user, $password);
$rjhRedbeanService->freeze($rjhRedbeanConfig['freeze']);
$rjhRedbeanService->debug($rjhRedbeanConfig['debug']);
return $rjhRedbeanService;
}
示例8: setup
/**
* Sets up the database connection.
* @param $dsn The datasource name. See: <a href="http://nl3.php.net/manual/en/pdo.construct.php">http://nl3.php.net/manual/en/pdo.construct.php</a>
* @code
* "sqlite:database.txt"
* "mysql:host=localhost;dbname=oodb"
* "pgsql:host=localhost;dbname=oodb"
* @endcode
* @param $username The database user's login username.
* @param $password The database user's login password.
*/
public static function setup($dsn, $username, $password)
{
assert('is_string($dsn) && $dsn != ""');
assert('$username == null || is_string($username) && $username != ""');
assert('$password == null || is_string($password)');
assert('!self::isSetup()');
try {
R::setup($dsn, $username, $password);
R::$redbean->addEventListener("update", new RedBeanBeforeUpdateHintManager(R::$toolbox));
if (SHOW_QUERY_DATA) {
Yii::app()->performance->setRedBeanQueryLogger(ZurmoRedBeanPluginQueryLogger::getInstanceAndAttach(R::$adapter));
}
$debug = defined('REDBEAN_DEBUG') && REDBEAN_DEBUG;
R::debug($debug);
self::$isSetup = true;
self::$databaseType = substr($dsn, 0, strpos($dsn, ':'));
} catch (Exception $e) {
self::close();
throw $e;
}
}
示例9: dirname
<?php
require 'external/mimvic/uvic.php';
require 'external/redbean/rb.php';
require 'external/tivoka/include.php';
require 'models/class.Model_Domain.php';
require 'models/class.Model_Drive.php';
require 'classes/class.rpcHandler.php';
require 'classes/class.ajaxHandler.php';
require 'classes/class.contentHandler.php';
require 'classes/class.dataCollectorHandler.php';
require 'classes/class.searchHandler.php';
require 'functions.php';
//require 'mobileDetect/MobileDetect.class.php';
use MiMViC as mvc;
$config = (require dirname(__FILE__) . '/../config.php');
mvc\store('config', $config);
$dsn = 'mysql:host=' . mvc\retrieve('config')->dbHost . ';dbname=' . mvc\retrieve('config')->dbName;
R::setup($dsn, mvc\retrieve('config')->dbUsername, mvc\retrieve('config')->dbPassword);
$linker = new RedBean_LinkManager(R::$toolbox);
mvc\store('beanLinker', $linker);
// TODO: RedBean freeze schema
//$detect = MobileDetect::getInstance();
$debug = false;
mvc\store('debug', $debug);
if ($debug) {
R::debug(true);
}
//$theme = $detect->isMobile() ? 'mobile' : 'desktop';
$theme = 'desktop';
mvc\store('theme', $theme);
示例10: trim
<?php
require "config.php";
require "external/rb.php";
R::setup('mysql:host=' . $dbserver . ';dbname=' . $dbname, $dbuser, $dbpassword);
R::freeze(TRUE);
R::debug(TRUE, 2);
R::addDatabase('localdb', 'mysql:host=' . $dbserver . ';dbname=' . $dbname, $dbuser, $dbpassword, TRUE);
R::begin();
require 'actions-web.php';
if (isset($_COOKIE["loguserid"])) {
$userid = $_COOKIE["loguserid"];
} else {
$userid = 0;
}
if (isset($_COOKIE["logsession"])) {
$session = $_COOKIE["logsession"];
}
$action = "";
if (isset($_GET["action"])) {
$action = trim($_GET["action"]);
}
switch ($action) {
case "smscode":
$number = trim($_GET["number"]);
smscode($number);
break;
case "register":
$number = trim($_GET["validatednumber"]);
$smscode = trim($_GET["smscode"]);
$checkcode = trim($_GET["checkcode"]);
示例11: install
public function install($debug = false)
{
/**
* Load models
*/
$this->load->model('account/account_model');
$this->load->model('account/group_model');
$this->load->model('account/uriresource_model');
$this->load->model('layout/layout_model');
$this->load->model('admin/modmenu_model');
$this->load->model('map_model');
$this->load->model('layer_model');
$this->load->model('mapserver/mapserver_model');
$this->load->model('googleearth/googleearth_model');
$this->load->model('openlayers/openlayers_model');
$this->load->model('admin/dataexplorer_model');
// Debug SQL
R::debug($debug);
// EMPTY DATABASE
R::nuke();
// Create admin account
$account_admin = $this->account_model->create('admin@domain.tld', 'admin', 'admin');
R::store($account_admin);
// Create guest account
$account_guest = $this->account_model->create('guest@domain.tld', 'guest', '');
R::store($account_guest);
// Create geo account
$account_geo = $this->account_model->create('geo@domain.tld', 'geo', 'geo');
R::store($account_geo);
// Create admin group
$group_admin = $this->group_model->create('admin');
R::store($group_admin);
// Create guest group
$group_guest = $this->group_model->create('guest');
R::store($group_admin);
// Create geo group
$group_geo = $this->group_model->create('geo');
R::store($group_geo);
// Add admin account to admin group
$group_admin->sharedAccount[] = $account_admin;
R::store($group_admin);
// Add guest account to guest group
$group_guest->sharedAccount[] = $account_guest;
R::store($group_guest);
// Add geo account to geo group
$group_geo->sharedAccount[] = $account_geo;
R::store($group_geo);
// Create Uri Resources
$uriresource_admin = $this->uriresource_model->create('/^admin/i');
R::store($uriresource_admin);
$uriresource_user = $this->uriresource_model->create('/^user/i');
R::store($uriresource_user);
// Add permission to guest group
$this->group_model->addPermission($group_guest, $uriresource_user, 'deny', 0);
$this->group_model->addPermission($group_guest, $uriresource_admin, 'deny', 0);
R::store($group_guest);
// Register authentication module block
$previewimg = 'web/images/module/simpleauth.png';
$authblock = $this->layout_model->createModule('Simple Authentication', 'account/modauth_lblock', NULL, $previewimg);
$authblock->owner = $account_admin;
R::store($authblock);
// Register tickets block
$previewimg = 'web/images/module/tickets.png';
$ticketsblock = $this->layout_model->createModule('Tickets', 'crm/tickets_lblock', NULL, $previewimg);
$ticketsblock->owner = $account_admin;
R::store($ticketsblock);
// Register layerswitcher block
$previewimg = 'web/images/module/layerswitcher.png';
$layerswitcherblock = $this->layout_model->createModule('Layer Switcher', 'openlayers/layerswitcher_lblock', 'olmap', $previewimg);
$layerswitcherblock->owner = $account_admin;
R::store($layerswitcherblock);
// Register Footer Module
$footermod = $this->layout_model->createModule('Footer', 'admin/footer_lblock');
$footermod->owner = $account_admin;
R::store($footermod);
// Register Credits Module
$creditsmod = $this->layout_model->createModule('Credits', 'admin/credits_lblock');
$creditsmod->owner = $account_admin;
R::store($creditsmod);
// Register language switcher module block
$previewimg = 'web/images/module/idiomswitcher.png';
$langblock = $this->layout_model->createModule('Language Selection', 'crm/lang_lblock', NULL, $previewimg);
$langblock->owner = $account_admin;
R::store($langblock);
// Register featuresearch block
$previewimg = 'web/images/module/featuresearch.png';
$searchblock = $this->layout_model->createModule('Feature Search', 'openlayers/featuresearch_lblock', 'olmap', $previewimg);
$searchblock->owner = $account_admin;
R::store($searchblock);
// Register Google Maps Api module
$modgmapsapi = $this->layout_model->createModule('Load Google Maps API', 'openlayers/modgmapsapiv3_lblock');
$modgmapsapi->owner = $account_admin;
R::store($modgmapsapi);
// Register gefeaturesearch block
$previewimg = 'web/images/module/gefeaturesearch.png';
$gesearchblock = $this->layout_model->createModule('Google Earth Search', 'googleearth/gefeaturesearch_lblock', 'gemap', $previewimg);
$gesearchblock->owner = $account_admin;
R::store($gesearchblock);
// Create layout
$layout_public = $this->layout_model->create('public', 'layout/publicfullscreen2');
//.........这里部分代码省略.........
示例12: init
function init()
{
// Setup our RedBean environment.
R::setup('mysql:host=' . DATABASE_HOST . '; dbname=' . DATABASE_NAME, DATABASE_USERNAME, DATABASE_PASSWORD, REDBEAN_FREEZE_ENABLED);
// Attempt to connect to the configured Database
if (!R::testConnection()) {
throw new Exception('Couldn\'t connect to database. Please check backend configuration.');
}
// Enable debug mode
R::debug(REDBEAN_DEBUG_ENABLED);
// Use camelCase for bean export
R::useExportCase('camel');
}
示例13: testpack
<?php
/**
* Pretest
*
* These tests will run before the configuration takes place
* in the unit test suite (mostly error handling tests).
*
* @file RedUNIT/Pretest.php
* @desc Test scripts that run before configuration
* @author Gabor de Mooij and the RedBeanPHP Community
* @license New BSD/GPLv2
*
* (c) G.J.G.T. (Gabor) de Mooij and the RedBeanPHP Community.
* This source file is subject to the New BSD/GPLv2 License that is bundled
* with this source code in the file license.txt.
*/
testpack('Running pre-tests. (before config).');
try {
R::debug(TRUE);
fail();
} catch (Exception $e) {
pass();
}
asrt(R::testConnection(), FALSE);
R::addDatabase('broken', 'mysql:host=nowhere', 'defunct', 'void');
R::selectDatabase('broken');
asrt(R::testConnection(), FALSE);
示例14: ConfigSetup
public static function ConfigSetup($arrconfig = null)
{
if (is_array($arrconfig) && !empty($arrconfig)) {
if ($arrconfig['server']) {
self::$server = $arrconfig['server'];
}
if ($arrconfig['databasename']) {
self::$databasename = $arrconfig['databasename'];
}
if ($arrconfig['username']) {
self::$username = $arrconfig['username'];
}
if ($arrconfig['password']) {
self::$password = $arrconfig['password'];
}
if ($arrconfig['port']) {
self::$port = $arrconfig['port'];
}
}
self::$connection = new PDO('mysql:host=' . self::$server . ';port=' . self::$port . ';dbname=' . self::$databasename . ';', self::$username, self::$password);
self::$connection->query('SET NAMES utf8');
R::setup(self::$connection);
R::freeze(true);
self::$logsrv = new \RedBeanPHP\Plugin\SystemlogsService();
R::debug(true, 1);
}
示例15: DupAndCache
/**
* Test duplication and caching.
*
* @return void
*/
public function DupAndCache()
{
testpack('Dup() and Cache');
$can = R::dispense('can')->setAttr('size', 3);
$can->ownCoffee[] = R::dispense('coffee')->setAttr('color', 'black');
$can->sharedTag[] = R::dispense('tag')->setAttr('name', 'cool');
$can = R::load('can', R::store($can));
$d = new RedBean_DuplicationManager(R::$toolbox);
$d->setCacheTables(TRUE);
ob_start();
R::debug(1);
$x = $d->dup($can);
$queries = ob_get_contents();
R::debug(0);
ob_end_clean();
$len1 = strlen($queries);
asrt($len1 > 40, TRUE);
asrt(isset($x->ownCoffee), TRUE);
asrt(count($x->ownCoffee), 1);
asrt(isset($x->sharedTag), TRUE);
asrt(count($x->sharedTag), 1);
$cache = $d->getSchema();
R::nuke();
$can = R::dispense('can')->setAttr('size', 3);
$can->ownCoffee[] = R::dispense('coffee')->setAttr('color', 'black');
$can->sharedTag[] = R::dispense('tag')->setAttr('name', 'cool');
$can = R::load('can', R::store($can));
$d = new RedBean_DuplicationManager(R::$toolbox);
/**
* $cache = '{"book": {
* "id": "INTEGER",
* "title": "TEXT"
* }, "bean": {
* "id": "INTEGER",
* "prop": "INTEGER"
* }, "pessoa": {
* "id": "INTEGER",
* "nome": "TEXT",
* "nome_meio": "TEXT",
* "sobrenome": "TEXT",
* "nascimento": "NUMERIC",
* "reg_owner": "TEXT"
* }, "documento": {
* "id": "INTEGER",
* "nome_documento": "TEXT",
* "numero_documento": "TEXT",
* "reg_owner": "TEXT",
* "ownPessoa_id": "INTEGER"
* }, "can": {
* "id": "INTEGER",
* "size": "INTEGER"
* }, "coffee": {
* "id": "INTEGER",
* "color": "TEXT",
* "can_id": "INTEGER"
* }, "tag": {
* "id": "INTEGER",
* "name": "TEXT"
* }, "can_tag": {
* "id": "INTEGER",
* "tag_id": "INTEGER",
* "can_id": "INTEGER"
* }}'
*/
$d->setTables($cache, 1);
ob_start();
R::debug(1);
$x = $d->dup($can);
$queries = ob_get_contents();
ob_end_clean();
R::debug(0);
$len2 = strlen($queries);
asrt(isset($x->ownCoffee), TRUE);
asrt(count($x->ownCoffee), 1);
asrt(isset($x->sharedTag), TRUE);
asrt(count($x->sharedTag), 1);
asrt(json_encode($cache), json_encode($d->getSchema()));
asrt($len1 > $len2, TRUE);
}