本文整理汇总了PHP中sugar_mkdir函数的典型用法代码示例。如果您正苦于以下问题:PHP sugar_mkdir函数的具体用法?PHP sugar_mkdir怎么用?PHP sugar_mkdir使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了sugar_mkdir函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: saveDictionaryToStorage
/**
* Save a dictionary for a particular API to storage
* @internal
* @param string $apiType The api type for the dictionary you want to load ("Rest" or "Soap")
* @param array $storageData The data that the API needs to store for it's dictionary.
*/
protected function saveDictionaryToStorage($apiType, $storageData)
{
if (!is_dir($this->cacheDir)) {
sugar_mkdir($this->cacheDir, null, true);
}
sugar_file_put_contents($this->cacheDir . 'ServiceDictionary.' . $apiType . '.php', '<' . "?php\n\$apiDictionary['" . $apiType . "'] = " . var_export($storageData, true) . ";\n");
}
示例2: testGetMetaDataFile
public function testGetMetaDataFile()
{
// backup custom file if it already exists
if (file_exists('custom/modules/Contacts/metadata/listviewdefs.php')) {
copy('custom/modules/Contacts/metadata/listviewdefs.php', 'custom/modules/Contacts/metadata/listviewdefs.php.bak');
unlink('custom/modules/Contacts/metadata/listviewdefs.php');
}
$this->_view->module = 'Contacts';
$this->_view->type = 'list';
$metaDataFile = $this->_view->getMetaDataFile();
$this->assertEquals('modules/Contacts/metadata/listviewdefs.php', $metaDataFile, 'Did not load the correct metadata file');
//test custom file
if (!file_exists('custom/modules/Contacts/metadata/')) {
sugar_mkdir('custom/modules/Contacts/metadata/', null, true);
}
$customFile = 'custom/modules/Contacts/metadata/listviewdefs.php';
if (!file_exists($customFile)) {
sugar_file_put_contents($customFile, array());
$customMetaDataFile = $this->_view->getMetaDataFile();
$this->assertEquals($customFile, $customMetaDataFile, 'Did not load the correct custom metadata file');
unlink($customFile);
}
// Restore custom file if we backed it up
if (file_exists('custom/modules/Contacts/metadata/listviewdefs.php.bak')) {
rename('custom/modules/Contacts/metadata/listviewdefs.php.bak', 'custom/modules/Contacts/metadata/listviewdefs.php');
}
}
示例3: post_install
function post_install()
{
// Include existing custom entry point registry array
@(include_once 'custom/include/MVC/Controller/entry_point_registry.php');
// Start building custom entry point PHP
$the_string = "<?php\n" . '// created: ' . date('Y-m-d H:i:s') . "\n\n";
// Define new entry point
$entry_point_registry['AsteriskController'] = array('file' => 'custom/modules/Asterisk/include/controller.php', 'auth' => true);
$entry_point_registry['AsteriskCallListener'] = array('file' => 'custom/modules/Asterisk/include/callListener.php', 'auth' => true);
$entry_point_registry['AsteriskCallCreate'] = array('file' => 'custom/modules/Asterisk/include/callCreate.php', 'auth' => true);
// For each custom entry point, add override value
foreach ($entry_point_registry as $key => $value) {
$the_string .= override_value_to_string('entry_point_registry', $key, $value) . "\n";
}
// Write the dir if needed
if (!is_dir('custom/include/MVC/Controller')) {
$result = sugar_mkdir('custom/include/MVC/Controller', NULL, true);
}
// Write the new custom entry point registry file
$result = @sugar_file_put_contents('custom/include/MVC/Controller/entry_point_registry.php', $the_string);
if ($_REQUEST['mode'] == 'Install') {
?>
<br /><br />
<span style="font-size: 2em;"><strong>Please review the documentation! There are several additional steps that must be taken.</strong></span>
<br /><span style="font-size: 1.3em;">The User Guide can be found on the Project website here: <a href="https://github.com/blak3r/yaai/wiki/User-Manual">https://github.com/blak3r/yaai/wiki/User-Manual</a></span>
<?php
}
}
示例4: setUp
public function setUp()
{
$this->authclassname = 'TestAuthClass' . mt_rand();
sugar_mkdir("custom/modules/Users/authentication/{$this->authclassname}/", null, true);
sugar_file_put_contents("custom/modules/Users/authentication/{$this->authclassname}/{$this->authclassname}.php", "<?php\nrequire_once 'modules/Users/authentication/SugarAuthenticate/SugarAuthenticate.php';\nclass {$this->authclassname} extends SugarAuthenticate {\n public \$userAuthenticateClass = '{$this->authclassname}User';\n public \$authenticationDir = '{$this->authclassname}';\n\n public function _construct(){\n\t parent::SugarAuthenticate();\n\t}\n}");
sugar_file_put_contents("custom/modules/Users/authentication/{$this->authclassname}/{$this->authclassname}User.php", "<?php\nrequire_once 'modules/Users/authentication/SugarAuthenticate/SugarAuthenticateUser.php';\nclass {$this->authclassname}User extends SugarAuthenticateUser {\n}");
}
示例5: create_module_lang_dir
/**
* @return bool
* @param module string
* @desc Creates the module's language directory under the custom directory.
*/
function create_module_lang_dir($module)
{
if (!is_dir("custom/modules/{$module}/language")) {
return sugar_mkdir("custom/modules/{$module}/language", null, true);
}
return true;
}
示例6: setUp
public function setUp()
{
sugar_mkdir('tests/include/utils/ziptest/testarchive', null, true);
sugar_touch('tests/include/utils/ziptest/testarchive/testfile1.txt');
sugar_touch('tests/include/utils/ziptest/testarchive/testfile2.txt');
sugar_touch('tests/include/utils/ziptest/testarchive/testfile3.txt');
sugar_mkdir('tests/include/utils/ziptest/testarchiveoutput', null, true);
}
示例7: renameDisabled
public function renameDisabled($files)
{
foreach ($files as $fileFrom => $fileTo) {
sugar_mkdir(dirname($fileTo), null, true);
sugar_rename($fileFrom, $fileTo);
$this->log('Custom view ' . $fileFrom . ' should be disabled (moved to ' . $fileTo . ')');
}
}
示例8: setUp
public function setUp()
{
$this->testdir = sugar_cached("tests/include/utils/ziptest");
sugar_mkdir($this->testdir . '/testarchive', null, true);
sugar_touch($this->testdir . '/testarchive/testfile1.txt');
sugar_touch($this->testdir . '/testarchive/testfile2.txt');
sugar_touch($this->testdir . '/testarchive/testfile3.txt');
sugar_mkdir($this->testdir . '/testarchiveoutput', null, true);
}
示例9: mkdir_recursive
function mkdir_recursive($path, $check_is_parent_dir = false)
{
if (sugar_is_dir($path, 'instance')) {
return true;
}
if (sugar_is_file($path, 'instance')) {
if (!empty($GLOBALS['log'])) {
$GLOBALS['log']->fatal("ERROR: mkdir_recursive(): argument {$path} is already a file.");
}
return false;
}
//make variables with file paths
$pathcmp = $path = rtrim(clean_path($path), '/');
$basecmp = $base = rtrim(clean_path(getcwd()), '/');
if (is_windows()) {
//make path variable lower case for comparison in windows
$pathcmp = strtolower($path);
$basecmp = strtolower($base);
}
if ($basecmp == $pathcmp) {
return true;
}
$base .= "/";
if (strncmp($pathcmp, $basecmp, strlen($basecmp)) == 0) {
/* strip current path prefix */
$path = substr($path, strlen($base));
}
$thePath = '';
$dirStructure = explode("/", $path);
if ($dirStructure[0] == '') {
// absolute path
$base = '/';
array_shift($dirStructure);
}
if (is_windows()) {
if (strlen($dirStructure[0]) == 2 && $dirStructure[0][1] == ':') {
/* C: prefix */
$base = array_shift($dirStructure) . "\\";
} elseif ($dirStructure[0][0] . $dirStructure[0][1] == "\\\\") {
/* UNC absolute path */
$base = array_shift($dirStructure) . "\\" . array_shift($dirStructure) . "\\";
// we won't try to mkdir UNC share name
}
}
foreach ($dirStructure as $dirPath) {
$thePath .= $dirPath . "/";
$mkPath = $base . $thePath;
if (!is_dir($mkPath)) {
if (!sugar_mkdir($mkPath)) {
return false;
}
}
}
return true;
}
示例10: testDisplayWithClassicCustomView
public function testDisplayWithClassicCustomView()
{
$view = $this->getMock('ViewClassic', array('includeClassicFile'));
$view->module = 'testmodule' . mt_rand();
$view->action = 'testaction' . mt_rand();
sugar_mkdir("custom/modules/{$view->module}", null, true);
sugar_touch("custom/modules/{$view->module}/{$view->action}.php");
$return = $view->display();
rmdir_recursive("custom/modules/{$view->module}");
$this->assertTrue($return);
}
示例11: setUp
public function setUp()
{
if (!is_dir(dirname(Bug44896PackageManger::$location))) {
sugar_mkdir(dirname(Bug44896PackageManger::$location));
}
if (!is_dir(Bug44896PackageManger::$location)) {
sugar_mkdir(Bug44896PackageManger::$location);
}
$manage = new Bug44896PackageManger();
$manage->createTempModule();
}
示例12: setUp
public function setUp()
{
if (!class_exists('ZipArchive')) {
$this->markTestSkipped('ZipArchive class not loaded');
}
$this->testdir = sugar_cached("tests/include/utils/ziptest");
sugar_mkdir($this->testdir . '/testarchive', null, true);
sugar_touch($this->testdir . '/testarchive/testfile1.txt');
sugar_touch($this->testdir . '/testarchive/testfile2.txt');
sugar_touch($this->testdir . '/testarchive/testfile3.txt');
sugar_mkdir($this->testdir . '/testarchiveoutput', null, true);
}
示例13: run
public function run()
{
if (version_compare($this->from_version, 7, '<')) {
$path = 'custom/Extension/application/Ext/Include/';
sugar_mkdir($path . 'Disabled/', null, true);
foreach ($this->modules as $module) {
$file = $module . '.php';
if (file_exists($path . $file)) {
sugar_rename($path . $file, $path . "Disabled/" . $file);
$this->log("Unsupported module {$module} disabled");
}
}
}
}
示例14: setUp
public function setUp()
{
$GLOBALS['current_user'] = SugarTestUserUtilities::createAnonymousUser();
$GLOBALS['app_list_strings'] = return_app_list_strings_language($GLOBALS['current_language']);
$GLOBALS['app_strings'] = return_application_language($GLOBALS['current_language']);
// Create a Custom editviewdefs.php
sugar_mkdir("custom/modules/Leads/metadata/", null, true);
if (is_dir("cache/modules/Leads")) {
rmdir_recursive("cache/modules/Leads");
}
if (file_exists("custom/modules/Leads/metadata/editviewdefs.php")) {
unlink("custom/modules/Leads/metadata/editviewdefs.php");
}
// Create a very simple custom EditView Layout
if ($fh = @fopen("custom/modules/Leads/metadata/editviewdefs.php", 'w+')) {
$string = <<<EOQ
<?php
\$viewdefs['Leads']['EditView'] = array('templateMeta' => array (
'form' => array('buttons' => array ('SAVE', 'CANCEL'),
'hidden' => array ('<a>HiddenPlaceHolder</a>',
),
),
'maxColumns' => '2',
'useTabs' => true,
'widths' => array( array ('label' => '10', 'field' => '30'),
array ('label' => '10', 'field' => '30'),
),
'javascript' => array( array ('file' => 'custom/modules/Leads/javascript/LeadJS1.js'),
array ('file' => 'custom/modules/Leads/javascript/LeadJS2.js'),
),
),
'panels' => array ('default' => array (0 => array (0 => array ('name' => 'first_name',
),
1 => array ('name' => 'last_name',
),
),
1 => array (0 => array ('name' => 'unknown_field',
'customCode' => '<a href="#">Unknown Field Link</a>',
),
),
),
),
);
?>
EOQ;
fputs($fh, $string);
fclose($fh);
}
}
示例15: testGetMetaDataFile
public function testGetMetaDataFile()
{
$this->_view->module = 'Contacts';
$this->_view->type = 'list';
$metaDataFile = $this->_view->getMetaDataFile();
$this->assertEquals('modules/Contacts/metadata/listviewdefs.php', $metaDataFile, 'Did not load the correct metadata file');
//test custom file
sugar_mkdir('custom/modules/Contacts/metadata/', null, true);
$customFile = 'custom/modules/Contacts/metadata/listviewdefs.php';
if (!file_exists($customFile)) {
sugar_file_put_contents($customFile, array());
$customMetaDataFile = $this->_view->getMetaDataFile();
$this->assertEquals($customFile, $customMetaDataFile, 'Did not load the correct custom metadata file');
unlink($customFile);
}
}