本文整理汇总了PHP中rex::getTempPrefix方法的典型用法代码示例。如果您正苦于以下问题:PHP rex::getTempPrefix方法的具体用法?PHP rex::getTempPrefix怎么用?PHP rex::getTempPrefix使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类rex
的用法示例。
在下文中一共展示了rex::getTempPrefix方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: prepareQuery
private static function prepareQuery($qry)
{
// rex::getUser() gibts im Setup nicht
$user = rex::getUser() ? rex::getUser()->getValue('login') : '';
$qry = str_replace('%USER%', $user, $qry);
$qry = str_replace('%TIME%', time(), $qry);
$qry = str_replace('%TABLE_PREFIX%', rex::getTablePrefix(), $qry);
$qry = str_replace('%TEMP_PREFIX%', rex::getTempPrefix(), $qry);
return $qry;
}
示例2: addFolderToTar
/**
* Fügt einem Tar-Archiv ein Ordner von Dateien hinzu.
*/
private static function addFolderToTar(rex_backup_tar $tar, $path, $dir)
{
$handle = opendir($path . $dir);
$isMediafolder = realpath($path . $dir) . '/' == rex_path::media();
while (false !== ($file = readdir($handle))) {
// Alles exportieren, außer ...
// - addons verzeichnis im mediafolder (wird bei addoninstallation wiedererstellt)
// - svn infos
// - tmp prefix Dateien
if ($file == '.' || $file == '..' || $file == '.svn') {
continue;
}
if (substr($file, 0, strlen(rex::getTempPrefix())) == rex::getTempPrefix()) {
continue;
}
if ($isMediafolder && $file == 'addons') {
continue;
}
if (is_dir($path . $dir . '/' . $file)) {
self::addFolderToTar($tar, $path . $dir . '/', $file);
} else {
$tar->addFile($path . $dir . '/' . $file);
}
}
closedir($handle);
}
示例3: testGetTempPrefix
public function testGetTempPrefix()
{
$this->assertEquals(rex::getTempPrefix(), 'tmp_', 'temp prefix defaults to tmp_');
}
示例4: rex_fragment
$n = [];
$n['label'] = rex_i18n::msg('backup_export_select');
$n['field'] = $radios;
$formElements[] = $n;
$fragment = new rex_fragment();
$fragment->setVar('elements', $formElements, false);
$content .= $fragment->parse('core/form/form.php');
$tableSelect = new rex_select();
$tableSelect->setMultiple();
$tableSelect->setId('rex-form-exporttables');
$tableSelect->setName('EXPTABLES[]');
$tableSelect->setAttribute('class', 'form-control');
$tables = rex_sql::showTables();
foreach ($tables as $table) {
$tableSelect->addOption($table, $table);
if ($table != rex::getTable('user') && 0 === strpos($table, rex::getTablePrefix()) && 0 !== strpos($table, rex::getTablePrefix() . rex::getTempPrefix())) {
$tableSelect->setSelected($table);
}
}
$formElements = [];
$n = [];
$n['header'] = '<div id="rex-js-exporttype-sql-div">';
$n['label'] = '<label for="rex-form-exporttables">' . rex_i18n::msg('backup_export_select_tables') . '</label>';
$n['field'] = $tableSelect->get();
$n['footer'] = '</div>';
$formElements[] = $n;
// Vorhandene Exporte auslesen
$sel_dirs = new rex_select();
$sel_dirs->setId('rex-form-exportdir');
$sel_dirs->setName('EXPDIR[]');
$sel_dirs->setMultiple();
示例5: foreach
<?php
// *************************************** SYNC FUNCTIONS
// ----- SYNC DB WITH FILES DIR
if ($PERMALL) {
// ---- Dateien aus dem Ordner lesen
$folder_files = [];
$path = rex_path::media();
$iterator = rex_finder::factory($path)->filesOnly()->ignoreFiles(['.*', rex::getTempPrefix() . '*'])->sort();
foreach ($iterator as $file) {
$folder_files[] = $file->getFilename();
}
// ---- Dateien aus der DB lesen
$db = rex_sql::factory();
$db->setQuery('SELECT * FROM ' . rex::getTablePrefix() . 'media');
$db_files = [];
$db_filenames = [];
foreach ($db->getArray() as $db_file) {
$db_filenames[] = $db_file['filename'];
$db_files[] = $db_file;
}
$diff_files = array_diff($folder_files, $db_filenames);
$diff_count = count($diff_files);
// Extra - filesize/width/height DB-Filesystem Sync
foreach ($db_files as $db_file) {
$file_filesize = filesize(rex_path::media($db_file['filename']));
if ($db_file['filesize'] != $file_filesize) {
$file_sql = rex_sql::factory();
$file_sql->debugsql = 1;
$file_sql->setTable(rex::getTable('media'));
$file_sql->setWhere(['filename' => $db_file['filename']]);