本文整理汇总了PHP中IOHelper::getLastModifiedFiles方法的典型用法代码示例。如果您正苦于以下问题:PHP IOHelper::getLastModifiedFiles方法的具体用法?PHP IOHelper::getLastModifiedFiles怎么用?PHP IOHelper::getLastModifiedFiles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IOHelper
的用法示例。
在下文中一共展示了IOHelper::getLastModifiedFiles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionSendSupportRequest
/**
* Creates a new support ticket for the GetHelp widget.
*
* @return null
*/
public function actionSendSupportRequest()
{
$this->requirePostRequest();
craft()->config->maxPowerCaptain();
$success = false;
$errors = array();
$zipFile = null;
$tempFolder = null;
$widgetId = craft()->request->getPost('widgetId');
$namespace = craft()->request->getPost('namespace');
$namespace = $namespace ? $namespace . '.' : '';
$getHelpModel = new GetHelpModel();
$getHelpModel->fromEmail = craft()->request->getPost($namespace . 'fromEmail');
$getHelpModel->message = trim(craft()->request->getPost($namespace . 'message'));
$getHelpModel->attachLogs = (bool) craft()->request->getPost($namespace . 'attachLogs');
$getHelpModel->attachDbBackup = (bool) craft()->request->getPost($namespace . 'attachDbBackup');
$getHelpModel->attachTemplates = (bool) craft()->request->getPost($namespace . 'attachTemplates');
$getHelpModel->attachment = UploadedFile::getInstanceByName($namespace . 'attachAdditionalFile');
if ($getHelpModel->validate()) {
$user = craft()->userSession->getUser();
// Add some extra info about this install
$message = $getHelpModel->message . "\n\n" . "------------------------------\n\n" . 'Craft ' . craft()->getEditionName() . ' ' . craft()->getVersion() . '.' . craft()->getBuild();
$plugins = craft()->plugins->getPlugins();
if ($plugins) {
$pluginNames = array();
foreach ($plugins as $plugin) {
$pluginNames[] = $plugin->getName() . ' ' . $plugin->getVersion() . ' (' . $plugin->getDeveloper() . ')';
}
$message .= "\nPlugins: " . implode(', ', $pluginNames);
}
$requestParamDefaults = array('sFirstName' => $user->getFriendlyName(), 'sLastName' => $user->lastName ? $user->lastName : 'Doe', 'sEmail' => $getHelpModel->fromEmail, 'tNote' => $message);
$requestParams = $requestParamDefaults;
$hsParams = array('helpSpotApiURL' => 'https://support.pixelandtonic.com/api/index.php');
try {
if ($getHelpModel->attachLogs || $getHelpModel->attachDbBackup) {
if (!$zipFile) {
$zipFile = $this->_createZip();
}
if ($getHelpModel->attachLogs && IOHelper::folderExists(craft()->path->getLogPath())) {
// Grab it all.
$logFolderContents = IOHelper::getFolderContents(craft()->path->getLogPath());
foreach ($logFolderContents as $file) {
// Make sure it's a file.
if (IOHelper::fileExists($file)) {
Zip::add($zipFile, $file, craft()->path->getStoragePath());
}
}
}
if ($getHelpModel->attachDbBackup && IOHelper::folderExists(craft()->path->getDbBackupPath())) {
// Make a fresh database backup of the current schema/data. We want all data from all tables
// for debugging.
craft()->db->backup();
$backups = IOHelper::getLastModifiedFiles(craft()->path->getDbBackupPath(), 3);
foreach ($backups as $backup) {
if (IOHelper::getExtension($backup) == 'sql') {
Zip::add($zipFile, $backup, craft()->path->getStoragePath());
}
}
}
}
if ($getHelpModel->attachment) {
// If we don't have a zip file yet, create one now.
if (!$zipFile) {
$zipFile = $this->_createZip();
}
$tempFolder = craft()->path->getTempPath() . StringHelper::UUID() . '/';
if (!IOHelper::folderExists($tempFolder)) {
IOHelper::createFolder($tempFolder);
}
$tempFile = $tempFolder . $getHelpModel->attachment->getName();
$getHelpModel->attachment->saveAs($tempFile);
// Make sure it actually saved.
if (IOHelper::fileExists($tempFile)) {
Zip::add($zipFile, $tempFile, $tempFolder);
}
}
if ($getHelpModel->attachTemplates) {
// If we don't have a zip file yet, create one now.
if (!$zipFile) {
$zipFile = $this->_createZip();
}
if (IOHelper::folderExists(craft()->path->getLogPath())) {
// Grab it all.
$templateFolderContents = IOHelper::getFolderContents(craft()->path->getSiteTemplatesPath());
foreach ($templateFolderContents as $file) {
// Make sure it's a file.
if (IOHelper::fileExists($file)) {
$templateFolderName = IOHelper::getFolderName(craft()->path->getSiteTemplatesPath(), false);
$siteTemplatePath = craft()->path->getSiteTemplatesPath();
$tempPath = substr($siteTemplatePath, 0, strlen($siteTemplatePath) - strlen($templateFolderName) - 1);
Zip::add($zipFile, $file, $tempPath);
}
}
}
}
//.........这里部分代码省略.........