Commit 08d75ae5 authored by speedprogs_de's avatar speedprogs_de

added ext_autoload.php, added scheudler-task base to get extension list, added...

added ext_autoload.php, added scheudler-task base to get extension list, added method to get modification time from a file or directory, renamed Utilities directory to Task

git-svn-id: https://svn.typo3.org/TYPO3v4/Extensions/terfe/branches/ter_fe2@43005 735d13b6-9817-0410-8766-e36946ffe9aa
parent 80301c3a
......@@ -226,5 +226,6 @@
$extKey = $this->request->getControllerExtensionKey();
return Tx_Extbase_Utility_Localization::translate($label, $extKey, $arguments);
}
}
?>
\ No newline at end of file
......@@ -33,8 +33,8 @@
class Tx_TerFe2_Service_FileHandlerService implements t3lib_Singleton {
/**
* Check if a file or folder exists
*
* Check if a file or directory exists
*
* @param string $filename Path to the file
* @return boolean TRUE if file exists
*/
......@@ -53,17 +53,17 @@
/**
* Get absolute path to a file
*
*
* @param string $filename Relative path to the file
* @return string Absolute path to file
*/
public function getAbsFilename($filename) {
$filename = t3lib_div::getFileAbsFileName($filename);
if (!$this->fileExists($filename)) {
return '';
if ($this->fileExists($filename)) {
return $filename;
}
return $filename;
return '';
}
......@@ -108,11 +108,31 @@
*/
public function getFileHash($filename) {
$filename = $this->getAbsFilename($filename);
if (empty($filename)) {
return '';
if (!empty($filename)) {
$result = @md5_file($filename);
if ($result !== FALSE) {
return $result;
}
}
return @md5_file($filename);
return '';
}
/**
* Get last modification time of a file or directory
*
* @param string $filename Path to the file
* @reutrn integer Timestamp of the modification time
*/
public function getModificationTime($filename) {
$filename = $this->getAbsFilename($filename);
if (!empty($filename)) {
// clearstatcache();
return (int) @filemtime($filename);
}
return 0;
}
......@@ -157,7 +177,7 @@
/**
* Get a list of all files in a directory
*
*
* @param string $dirname Path to the directory
* @param boolean $recursive Get subfolder content too
* @return array All contained files
......@@ -187,7 +207,7 @@
/**
* Get all files in a directory by filetype
*
*
* @param string $dirname Path to the directory
* @param string $fileType Type of the files to find
* @param boolean $recursive Get subfolder content too
......@@ -206,5 +226,6 @@
return $result;
}
}
?>
\ No newline at end of file
<?php
/*******************************************************************
* Copyright notice
*
* (c) 2011 Thomas Loeffler <loeffler@spooner-web.de>, Spooner Web
* Kai Vogel <kai.vogel@speedprogs.de>, Speedprogs.de
*
* All rights reserved
*
* This script is part of the TYPO3 project. The TYPO3 project is
* free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* The GNU General Public License can be found at
* http://www.gnu.org/copyleft/gpl.html.
*
* This script is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* This copyright notice MUST APPEAR in all copies of the script!
******************************************************************/
/**
* Update extension list task
*
* @version $Id$
* @copyright Copyright belongs to the respective authors
* @license http://www.gnu.org/licenses/gpl.html GNU General Public License, version 3 or later
*/
class Tx_TerFe2_Task_UpdateExtensionListTask extends tx_scheduler_Task {
/**
* Public method, usually called by scheduler.
*
* @return boolean True on success
*/
public function execute() {
}
}
?>
\ No newline at end of file
......@@ -52,6 +52,9 @@
<label index="tx_terfe2_domain_model_relation.tx_terfe2_key">extension key, php, mysql or something else</label>
<label index="tx_terfe2_domain_model_relation.version">Version of the field "key", e.g. key "php" and version "5.2"</label>
<label index="tx_terfe2_task_updateextensionlisttask.name">Get new extensions</label>
<label index="tx_terfe2_task_updateextensionlisttask.description">Get new extensions in ter directory</label>
<label index="msg_extension_created">Extension created</label>
<label index="msg_extension_updated">Extension updated</label>
<label index="msg_file_not_valid">Given file is not valid</label>
......
<?php
$extensionPath = t3lib_extMgm::extPath('ter_fe2');
return array(
'tx_terfe2_task_updateextensionlisttask' => $extensionPath . '/Classes/Task/UpdateExtensionListTask.php',
);
?>
\ No newline at end of file
......@@ -14,4 +14,12 @@
'Extension' => 'create, update, delete, createVersion',
)
);
// Register extension list update task
$GLOBALS['TYPO3_CONF_VARS']['SC_OPTIONS']['scheduler']['tasks']['Tx_TerFe2_Task_UpdateExtensionListTask'] = array(
'extension' => $_EXTKEY,
'title' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang.xml:tx_terfe2_task_updateextensionlisttask.name',
'description' => 'LLL:EXT:' . $_EXTKEY . '/Resources/Private/Language/locallang.xml:tx_terfe2_task_updateextensionlisttask.description',
'additionalFields' => '',
);
?>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment