本文整理汇总了PHP中CRM_Utils_File::sourceSQLFile方法的典型用法代码示例。如果您正苦于以下问题:PHP CRM_Utils_File::sourceSQLFile方法的具体用法?PHP CRM_Utils_File::sourceSQLFile怎么用?PHP CRM_Utils_File::sourceSQLFile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CRM_Utils_File
的用法示例。
在下文中一共展示了CRM_Utils_File::sourceSQLFile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadSavedSearches
/**
* Load saved search sql files into the DB.
*/
public function loadSavedSearches()
{
$dsn = CRM_Core_Config::singleton()->dsn;
foreach (glob(dirname(__FILE__) . "/SavedSearchDataSets/*.sql") as $file) {
CRM_Utils_File::sourceSQLFile($dsn, $file);
}
}
示例2: civicrm_api3_speakcivi_update_stats
function civicrm_api3_speakcivi_update_stats($params)
{
$config = CRM_Core_Config::singleton();
$sql = file_get_contents(dirname(__FILE__) . '/../../sql/update.sql', true);
CRM_Utils_File::sourceSQLFile($config->dsn, $sql, NULL, true);
return civicrm_api3_create_success(array("query" => $sql), $params);
}
示例3: offlinerecurringcontributions_civicrm_install
/**
* Implements hook_civicrm_install().
*
* @link http://wiki.civicrm.org/confluence/display/CRMDOC/hook_civicrm_install
*/
function offlinerecurringcontributions_civicrm_install()
{
$extensionDir = dirname(__FILE__) . DIRECTORY_SEPARATOR;
$sqlName = $extensionDir . 'sql' . DIRECTORY_SEPARATOR . 'update.sql';
CRM_Utils_File::sourceSQLFile(CIVICRM_DSN, $sqlName);
_offlinerecurringcontributions_civix_civicrm_install();
}
示例4: testReportOutput
/**
* @dataProvider dataProvider
*/
public function testReportOutput($reportClass, $inputParams, $dataSet, $expectedOutputCsvFile)
{
$config = CRM_Core_Config::singleton();
CRM_Utils_File::sourceSQLFile($config->dsn, dirname(__FILE__) . "/{$dataSet}");
$reportCsvFile = $this->getReportOutputAsCsv($reportClass, $inputParams);
$reportCsvArray = $this->getArrayFromCsv($reportCsvFile);
$expectedOutputCsvArray = $this->getArrayFromCsv(dirname(__FILE__) . "/{$expectedOutputCsvFile}");
$this->assertCsvArraysEqual($expectedOutputCsvArray, $reportCsvArray);
}
示例5: eventcalendar_civicrm_uninstall
/**
* Implementation of hook_civicrm_uninstall
*/
function eventcalendar_civicrm_uninstall()
{
$cividiscountRoot = dirname(__FILE__) . DIRECTORY_SEPARATOR;
$cividiscountSQL = $cividiscountRoot . DIRECTORY_SEPARATOR . 'uninstall.sql';
CRM_Utils_File::sourceSQLFile(CIVICRM_DSN, $cividiscountSQL);
// rebuild the menu so our path is picked up
CRM_Core_Invoke::rebuildMenuAndCaches();
//return _eventcalendar_civix_civicrm_uninstall();
}
示例6: banking_civicrm_enable
/**
* Implementation of hook_civicrm_enable
*/
function banking_civicrm_enable()
{
//add the required option groups
banking_civicrm_install_options(_banking_options());
// run the update script
$config = CRM_Core_Config::singleton();
$sql = file_get_contents(dirname(__FILE__) . '/sql/upgrade.sql', true);
CRM_Utils_File::sourceSQLFile($config->dsn, $sql, NULL, true);
return _banking_civix_civicrm_enable();
}
示例7: postProcess
function postProcess()
{
$config = CRM_Core_Config::singleton();
$extenDr = $config->extensionsDir;
$sDbScriptsDir = $extenDr . DIRECTORY_SEPARATOR . 'uk.co.vedaconsulting.recurdatafix' . DIRECTORY_SEPARATOR . 'sql' . DIRECTORY_SEPARATOR;
CRM_Utils_File::sourceSQLFile(CIVICRM_DSN, sprintf("%supdate.sql", $sDbScriptsDir));
//CRM_Core_Session::setStatus('Updated table civicrm_recur table with membership id', 'Success', 'info');
CRM_Utils_System::redirect(CRM_Utils_System::url('civicrm/recurdatafix/create', 'reset=1'));
CRM_Utils_System::civiExit();
}
示例8: _civicrm_load_navigation
/**
* Load the navigation sql for the domain with the given name.
*
* @param string $domainName
* @param int $domainID
*/
function _civicrm_load_navigation($domainName, $domainID)
{
global $civicrm_root;
$sqlPath = $civicrm_root . DIRECTORY_SEPARATOR . 'sql';
$config = CRM_Core_Config::singleton();
$generatedFile = $config->uploadDir . DIRECTORY_SEPARATOR . str_replace(' ', '_', $domainName) . uniqid() . 'nav.mysql';
//read the entire string
$str = file_get_contents($sqlPath . DIRECTORY_SEPARATOR . 'civicrm_navigation.mysql');
$str = str_replace('SELECT @domainID := id FROM civicrm_domain where name = \'Default Domain Name\'', "SELECT @domainID := {$domainID}", $str);
file_put_contents($generatedFile, $str);
CRM_Utils_File::sourceSQLFile($config->dsn, $generatedFile, NULL, FALSE);
CRM_Core_DAO::executeQuery("UPDATE civicrm_navigation SET label = name WHERE label = ''");
}
示例9: findCreateTable
/**
* Ensure that the required SQL table exists
*
* @return bool TRUE if table now exists
*/
static function findCreateTable()
{
$checkTableSql = "show tables like 'civicrm_queue_item'";
$foundName = CRM_Core_DAO::singleValueQuery($checkTableSql);
if ($foundName == 'civicrm_queue_item') {
return TRUE;
}
// civicrm/sql/civicrm_queue_item.mysql
$fileName = dirname(__FILE__) . '/../../../sql/civicrm_queue_item.mysql';
$config = CRM_Core_Config::singleton();
CRM_Utils_File::sourceSQLFile($config->dsn, $fileName);
// Make sure it succeeded
$foundName = CRM_Core_DAO::singleValueQuery($checkTableSql);
return $foundName == 'civicrm_queue_item';
}
示例10: onUninstall
public function onUninstall()
{
if (is_callable(array($this, 'uninstall'))) {
$this->uninstall();
}
$files = glob($this->extensionDir . '/sql/*_uninstall.sql');
if (is_array($files)) {
foreach ($files as $file) {
CRM_Utils_File::sourceSQLFile(CIVICRM_DSN, $file);
}
}
$this->setCurrentRevision(NULL);
}
示例11: source
function source($fileName, $isQueryString = false)
{
require_once 'CRM/Utils/File.php';
CRM_Utils_File::sourceSQLFile($this->_config->dsn, $fileName, null, $isQueryString);
}
示例12: dropAllTables
public static function dropAllTables()
{
// first drop all the custom tables we've created
CRM_Core_BAO_CustomGroup::dropAllTables();
// drop all multilingual views
CRM_Core_I18n_Schema::dropAllViews();
CRM_Utils_File::sourceSQLFile(CIVICRM_DSN, dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'sql' . DIRECTORY_SEPARATOR . 'civicrm_drop.mysql');
}
示例13: dropAllTables
static function dropAllTables()
{
// first drop all the custom tables we've created
require_once 'CRM/Core/BAO/CustomGroup.php';
CRM_Core_BAO_CustomGroup::dropAllTables();
// drop all multilingual views
require_once 'CRM/Core/I18n/Schema.php';
CRM_Core_I18n_Schema::dropAllViews();
require_once 'CRM/Utils/File.php';
CRM_Utils_File::sourceSQLFile(CIVICRM_DSN, dirname(__FILE__) . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . '..' . DIRECTORY_SEPARATOR . 'sql' . DIRECTORY_SEPARATOR . 'civicrm_drop.mysql');
}
示例14: sepa_civicrm_install
/**
* Implementation of hook_civicrm_install
*/
function sepa_civicrm_install()
{
$config = CRM_Core_Config::singleton();
//create the tables
$sql = file_get_contents(dirname(__FILE__) . '/sql/sepa.sql', true);
CRM_Utils_File::sourceSQLFile($config->dsn, $sql, NULL, true);
return _sepa_civix_civicrm_install();
}
示例15: source
/**
* @param string $fileName
* @param bool $isQueryString
*/
public function source($fileName, $isQueryString = FALSE)
{
CRM_Utils_File::sourceSQLFile($this->_config->dsn, $fileName, NULL, $isQueryString);
}