public function execute() { require_once PATH_site . 'typo3conf/ext/additional_scheduler/Classes/Utils.php'; require_once PATH_site . 'typo3conf/ext/additional_scheduler/Classes/Templating.php'; // templating $template = new \Sng\Additionalscheduler\Templating(); if (!empty($this->emailtemplate)) { $template->initTemplate($this->emailtemplate); } else { $template->initTemplate('typo3conf/ext/additional_scheduler/Resources/Private/Templates/execquery.html'); } $markersArray = array(); // exec query $res = $GLOBALS['TYPO3_DB']->sql_query($this->query); $return = ''; if (preg_match('/SELECT.*?FROM/i', $this->query, $matches)) { $i = 0; $return .= '<table>'; while ($item = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res)) { if ($i === 0) { $return .= '<thead>'; $return .= '<tr>'; foreach ($item as $itemKey => $itemValue) { $return .= '<th>' . $itemKey . '</th>'; } $return .= '</tr>'; $return .= '</thead>'; $return .= '<tbody>'; } $return .= '<tr>'; foreach ($item as $itemKey => $itemValue) { $return .= '<td>' . $itemValue . '</td>'; } $return .= '</tr>'; $i++; } $return .= '</tbody>'; $return .= '</table>'; $GLOBALS['TYPO3_DB']->sql_free_result($res); } else { $return .= 'SQL : ' . $this->query; } $markersArray['###MAIL_CONTENT###'] = $return; $mailcontent = $template->renderAllTemplate($markersArray, '###EMAIl_TEMPLATE###'); preg_match('/<title\\>(.*?)<\\/title>/', $mailcontent, $matches); // mail $mailTo = $this->email; $mailSubject = '[additional_scheduler] : ' . $GLOBALS['LANG']->sL('LLL:EXT:additional_scheduler/Resources/Private/Language/locallang.xml:task.execquery.name'); if (!empty($matches[1])) { $mailSubject = $matches[1]; } if (empty($this->email) !== TRUE) { \Sng\Additionalscheduler\Utils::sendEmail($mailTo, $mailSubject, $mailcontent, 'html', $this->emailfrom, $this->emailfrom, 'utf-8'); } return TRUE; }
public function execute() { require_once PATH_site . 'typo3conf/ext/additional_scheduler/Classes/Utils.php'; // exec SH $saveScript = PATH_site . 'typo3conf/ext/additional_scheduler/Resources/Shell/save_typo3_website.sh'; $cmd = $saveScript . ' -p ' . PATH_site . ' -o ' . $this->path . ' -f'; $return = shell_exec($cmd . ' 2>&1'); // mail $mailTo = $this->email; $mailSubject = '[additional_scheduler] : ' . $GLOBALS['LANG']->sL('LLL:EXT:additional_scheduler/Resources/Private/Language/locallang.xml:task.savewebsite.name'); $mailBody = $cmd . LF . LF . $return; if (empty($this->email) !== true) { \Sng\Additionalscheduler\Utils::sendEmail($mailTo, $mailSubject, $mailBody, 'plain', 'utf-8'); } return true; }
/** * Executes the commit task and returns TRUE if the execution was * succesfull * * @return boolean returns TRUE on success, FALSE on failure */ public function execute() { require_once PATH_site . 'typo3conf/ext/additional_scheduler/Classes/Utils.php'; // exec SH if (substr($this->path, 0, 1) == '/') { $cmd = $this->path; } else { $cmd = PATH_site . $this->path; } $return = shell_exec($cmd . ' 2>&1'); // mail $mailTo = $this->email; $mailSubject = '[additional_scheduler] : ' . $GLOBALS['LANG']->sL('LLL:EXT:additional_scheduler/Resources/Private/Language/locallang.xml:task.exec.name'); $mailBody = $cmd . LF . LF . $return; if (empty($this->email) !== TRUE) { \Sng\Additionalscheduler\Utils::sendEmail($mailTo, $mailSubject, $mailBody, 'plain', $this->emailfrom, $this->emailfrom, 'utf-8'); } return TRUE; }