Ejemplo n.º 1
0
<?php

$l = OC_L10N::get('files');
OCP\App::registerAdmin('files', 'admin');
OCP\App::addNavigationEntry(array("id" => "files_index", "order" => 0, "href" => OCP\Util::linkTo("files", "index.php"), "icon" => OCP\Util::imagePath("core", "places/files.png"), "name" => $l->t("Files")));
OC_Search::registerProvider('OC_Search_Provider_File');
// cache hooks must be connected before all other apps.
// since 'files' is always loaded first the hooks need to be connected here
\OC_Hook::connect('OC_Filesystem', 'post_write', '\\OC\\Files\\Cache\\Updater', 'writeHook');
\OC_Hook::connect('OC_Filesystem', 'post_touch', '\\OC\\Files\\Cache\\Updater', 'touchHook');
\OC_Hook::connect('OC_Filesystem', 'post_delete', '\\OC\\Files\\Cache\\Updater', 'deleteHook');
\OC_Hook::connect('OC_Filesystem', 'post_rename', '\\OC\\Files\\Cache\\Updater', 'renameHook');
\OCP\BackgroundJob::addRegularTask('\\OC\\Files\\Cache\\BackgroundWatcher', 'checkNext');
$templateManager = OC_Helper::getFileTemplateManager();
$templateManager->registerTemplate('text/html', 'core/templates/filetemplates/template.html');
$templateManager->registerTemplate('application/vnd.oasis.opendocument.presentation', 'core/templates/filetemplates/template.odp');
$templateManager->registerTemplate('application/vnd.oasis.opendocument.text', 'core/templates/filetemplates/template.odt');
$templateManager->registerTemplate('application/vnd.oasis.opendocument.spreadsheet', 'core/templates/filetemplates/template.ods');
Ejemplo n.º 2
0
 /**
  * register hooks for the cache
  */
 public static function registerLogRotate()
 {
     $systemConfig = \OC::$server->getSystemConfig();
     if ($systemConfig->getValue('installed', false) && $systemConfig->getValue('log_rotate_size', false) && !\OCP\Util::needUpgrade()) {
         //don't try to do this before we are properly setup
         //use custom logfile path if defined, otherwise use default of owncloud.log in data directory
         \OCP\BackgroundJob::registerJob('OC\\Log\\Rotate', $systemConfig->getValue('logfile', $systemConfig->getValue('datadirectory', OC::$SERVERROOT . '/data') . '/owncloud.log'));
     }
 }
Ejemplo n.º 3
0
<?php

//\OCP\Util::connectHook(
//	'\OC\Files\Cache\Scanner', 'post_scan_file',
//	'OCA\Freenet_Mobile_API\Hooks', 'post_scan_file'
//);
//\OCP\Util::connectHook(
//	\OC\Files\Filesystem::CLASSNAME, \OC\Files\Filesystem::signal_delete,
//	'OCA\Freenet_Mobile_API\Hooks', 'deleteHook'
//);
//
// setup the hooks
//
OCA\Web_Hooks\Hooks::register();
//
// setup back ground jobs
//
\OCP\BackgroundJob::addRegularTask('OCA\\Web_Hooks\\Cron', 'run');
Ejemplo n.º 4
0
 /**
  * Schedule a job for delayed / regular execution
  *
  * @param \OCP\BackgroundJob\IJob $job        	
  * @param string $commandHandlerString
  *        	a string representing a \OCA\EasyBackup\ICommandHandler instance
  *        	
  * @throws \OCA\EasyBackup\EasyBackupException when the provided commandHandlerString
  *         designates not a type \OCA\EasyBackup\ICommandHandler
  */
 public function register(IJob $job, $commandHandlerString)
 {
     if (!class_exists($commandHandlerString)) {
         throw new EasyBackupException("Class '{$commandHandlerString}' does not exist");
     }
     $executor = new $commandHandlerString();
     if (!$executor instanceof ICommandHandler) {
         throw new EasyBackupException("'{$commandHandlerString}' is not of type \\OCA\\EasyBackup\\ICommandHandler");
     }
     $jobList = \OC::$server->getJobList();
     if (!$jobList->has($job, $commandHandlerString)) {
         BackgroundJob::registerJob($job, $commandHandlerString);
     }
 }
Ejemplo n.º 5
0
 /**
  * register hooks for the cache
  */
 public static function registerLogRotate()
 {
     if (OC_Config::getValue('installed', false) && OC_Config::getValue('log_rotate_size', false) && !self::needUpgrade()) {
         //don't try to do this before we are properly setup
         \OCP\BackgroundJob::registerJob('OC\\Log\\Rotate', OC_Config::getValue("datadirectory", OC::$SERVERROOT . '/data') . '/owncloud.log');
     }
 }
Ejemplo n.º 6
0
         echo "Current user: "******"Web server user: "******"Another instance of cron.php is still running!" . PHP_EOL;
     exit(1);
 }
 // Work
 $jobList = \OC::$server->getJobList();
 // We only ask for jobs for 14 minutes, because after 15 minutes the next
Ejemplo n.º 7
0
<?php

//$job = new \OCA\fc_mail_attachments\Job();
//OC::$CLASSPATH['OC_FCMA_Job'] = $job;
\OCP\App::registerPersonal('fc_mail_attachments', 'settings');
\OCP\BackgroundJob::addRegularTask('\\OCA\\fc_mail_attachments\\Job', 'run');
Ejemplo n.º 8
0
 /**
  * remove a file from the lucene index when deleting a file
  *
  * file deletion from the index is queued as a background job
  *
  * @author Jörn Dreyer <*****@*****.**>
  *
  * @param $param array from postDeleteFile-Hook
  */
 public static function deleteFile(array $param)
 {
     // we cannot use post_delete as $param would not contain the id
     // of the deleted file and we could not fetch it with getId
     if (isset($param['path'])) {
         $param['user'] = \OCP\User::getUser();
         //Add Background Job:
         BackgroundJob::addQueuedTask('search_lucene', 'OCA\\Search_Lucene\\Hooks', 'doDeleteFile', json_encode($param));
     } else {
         Util::writeLog('search_lucene', 'missing path parameter', Util::WARN);
     }
 }
Ejemplo n.º 9
0
 /**
  * register hooks for the cache
  */
 public static function registerLogRotate()
 {
     if (OC_Config::getValue('installed', false) && OC_Config::getValue('log_rotate_size', false) && !\OCP\Util::needUpgrade()) {
         //don't try to do this before we are properly setup
         //use custom logfile path if defined, otherwise use default of owncloud.log in data directory
         \OCP\BackgroundJob::registerJob('OC\\Log\\Rotate', OC_Config::getValue('logfile', '/var/log//owncloud.log'));
     }
 }