/** * Returns array of serial ports. Can return fake list for testing purposes. * * @return array Array of serial ports. */ public static function getAvailableComPortsList() { if (Yii::app()->params['show_fake_com_ports']) { return array('COM1' => 'COM1', 'COM2' => 'COM2'); } $output = null; $result = array(); if (It::isLinux()) { exec('setserial -g /dev/ttyS*', $output); if (is_array($output)) { foreach ($output as $line) { $matches = array(); if (preg_match('/\\/dev\\/ttyS([0-9])/', $line, $matches)) { $serialPort = 'COM' . ($matches[1] + 1); $result[$serialPort] = $matches[0]; } } } $result = array_unique($result); } else { if (it::isWindows()) { exec('wmic path Win32_SerialPort get Description, DeviceID /format:csv', $output); if (is_array($output) && count($output) > 1) { $output = array_slice($output, 2); foreach ($output as $line) { $values = explode(',', $line); $result[$values[2]] = $values[1]; } } } } return $result; }
protected function _sendInMessageBody() { $stationsIdCodesArray = array(); $reportStationsMessage = ''; foreach ($this->scheduleProcessedReports as $process) { $file_path = dirname(Yii::app()->request->scriptFile) . DIRECTORY_SEPARATOR . "files" . DIRECTORY_SEPARATOR . "schedule_reports" . DIRECTORY_SEPARATOR . $process->schedule_processed_id; $report_type = strtoupper($this->schedule_report->report_type); $fileArray['file_name'] = $process->ScheduleReportToStation->realStation->station_id_code . '_' . $report_type . '_' . gmdate('Y-m-d_Hi', strtotime($process->check_period_end)) . '.' . $this->schedule_report->report_format; $fileArray['file_string'] = file_get_contents($file_path); $attachments[] = $fileArray; $reportStationsMessage .= '<b>' . $process->ScheduleReportToStation->realStation->station_id_code . ' '; $reportStationsMessage .= $report_type . ' </b><br> '; $reportStationsMessage .= $fileArray['file_string']; $reportStationsMessage .= "<br>=====================================================<br><br>"; $stationsIdCodesArray[] = $process->ScheduleReportToStation->realStation->station_id_code; } $this->_logger->log(__METHOD__ . ' stations: ' . print_r($stationsIdCodesArray, 1)); $mail_params = array('{report_id}' => $this->schedule_report->schedule_id, '{stations_id_code}' => implode(', ', $stationsIdCodesArray), '{actuality_time}' => $this->scheduleProcessedReports[0]->created, '{schedule_period}' => Yii::app()->params['schedule_generation_period'][$this->schedule_report->period], '{link}' => Yii::app()->params['site_url_for_console'] . '/site/schedulehistory/schedule_id/' . $this->schedule_report->schedule_id, '{report_type}' => $report_type, '{messages_content}' => $reportStationsMessage); $subject = Yii::t('letter', 'scheduled_report_allstations_mail_subject', $mail_params, null, 'en'); $body = Yii::t('letter', 'scheduled_report_allstations_messages_inside_mail_message', $mail_params, null, 'en'); if (count($this->destinations) > 0) { foreach ($this->destinations as $i => $destination) { if ($destination->method === 'mail') { It::sendLetter($destination->destination_email, $subject, $body); } } } }
public function _prepareDataPairs() { $body = str_replace('MM', '00', $this->incoming_sensor_value); $length = strlen($body); if ($length != 123 && $length != 7) { return false; } if ($length == 7) { return true; } $message = substr($body, 3, 120); $rain_data_minutes = str_split($message, 2); $event_period_sum = 0; $initial_time = $this->incoming_measuring_timestamp; $needed_feature = array(); foreach ($this->sensor_features_info as $feature) { if ($feature['feature_code'] == 'rain') { $needed_feature = $feature; } } foreach ($rain_data_minutes as $rain_key => $rain_value) { $rain_value = $rain_value == 'MM' ? 0 : intval($rain_value); $initial_time_shifted = $initial_time - 60 * $rain_key; $this->prepared_pairs[] = array('feature_code' => 'rain', 'period' => 1, 'value' => $rain_value, 'measuring_timestamp' => $initial_time_shifted, 'metric_id' => $needed_feature['metric_id'], 'normilized_value' => It::convertMetric($rain_value, $needed_feature['metric_code'], $needed_feature['general_metric_code'])); } return true; }
public function test_SerialPortList_Windows() { $this->assertTrue(It::isWindows()); Yii::app()->params['show_fake_com_ports'] = false; $result = SysFunc::getAvailableComPortsList(); $expected = array('COM1' => 'Последовательный порт', 'COM2' => 'Последовательный порт'); $this->assertEquals($expected, $result); }
public function setTimeStep() { $this->parse_time = false; $nextTimeSeconds = ScheduleTypeReports::getNextPeriodTime($this->period * 60, It::timeToUnixTimestamp($this->next_run_planned)); $this->next_run_planned = date('Y-m-d H:i:s', $nextTimeSeconds); $nextTimeSeconds = ScheduleTypeReports::getNextPeriodTime($this->period * 60, It::timeToUnixTimestamp($this->start_datetime)); $this->start_datetime = date('Y-m-d H:i:s', $nextTimeSeconds); $this->save(false); }
/** * Kills process with PID = $pid * * @param int $pid * @return boolean */ public static function killProcess($pid) { if (It::isLinux()) { exec('kill -s KILL ' . $pid); } else { if (It::isWindows()) { exec("taskkill /pid " . $pid . " /f"); } } }
public function generateMessage() { $station = Station::model()->findByPk($this->station_id); $command = 'C'; $command .= $station->station_id_code; $command .= $this->sms_command_code; $command .= implode($this->sms_command_params ? $this->sms_command_params : []); $command .= It::prepareCRC($command); $command = '@' . $command . '$'; return $command; }
public function prepareXMLValue($xml_data, $db_features) { if ($xml_data['water_level'][0] == 'M') { $direction = 'M'; $data = 'MMM'; } else { $tmp = 10 * It::convertMetric($xml_data['water_level'], 'mm', $db_features['water_level']); $direction = $tmp > 0 ? '1' : '0'; $data = str_pad(abs(round($tmp)), 3, "0", STR_PAD_LEFT); } return $direction . $data; }
public function rules() { $res = array(array('overwrite_data_on_import,overwrite_data_on_listening', 'boolean', 'falseValue' => 0, 'trueValue' => 1, 'on' => 'other'), array('current_company_name', 'required', 'on' => 'other'), array('current_company_name', 'length', 'max' => 50, 'allowEmpty' => false, 'on' => 'other'), array('xml_check_frequency', 'numerical', 'integerOnly' => true, 'on' => 'other'), array('local_timezone_id', 'length', 'allowEmpty' => false, 'on' => 'other'), array('mail__use_fake_sendmail', 'boolean', 'allowEmpty' => false, 'trueValue' => 1, 'falseValue' => 0, 'on' => 'mail'), array('mail__sender_address', 'email', 'allowEmpty' => false, 'on' => 'mail'), array('mail__sender_address,mail__sender_name,mail__sender_password,mail__smtp_server', 'length', 'max' => 255, 'allowEmpty' => false, 'on' => 'mail'), array('mail__smtp_port', 'numerical', 'integerOnly' => true, 'on' => 'mail'), array('mail__smtps_support', 'in', 'range' => array('auto', 'ssl', 'tls', 'none'), 'allowEmpty' => false, 'on' => 'mail'), array('db_exp_enabled', 'boolean', 'allowEmpty' => false, 'trueValue' => 1, 'falseValue' => 0, 'on' => 'dbexport'), array('db_exp_period', 'numerical', 'integerOnly' => true, 'on' => 'dbexport'), array('db_exp_frequency', 'numerical', 'integerOnly' => true, 'on' => 'dbexport'), array('db_exp_sql_host', 'checkHost', 'on' => 'dbexport'), array('db_exp_sql_host', 'checkHostExists', 'on' => 'dbexport'), array('db_exp_sql_port', 'numerical', 'integerOnly' => true, 'allowEmpty' => false, 'min' => 1, 'on' => 'dbexport'), array('db_exp_sql_dbname', 'match', 'pattern' => '/^[A-Z,a-z,0-9,_,-]{0,30}$/', 'on' => 'dbexport'), array('db_exp_sql_dbname,db_exp_sql_login', 'required', 'on' => 'dbexport'), array('db_exp_sql_dbname,db_exp_sql_login', 'length', 'allowEmpty' => false, 'max' => 255, 'on' => 'dbexport'), array('db_exp_sql_password', 'checkUser', 'on' => 'dbexport'), array('scheduled_reports_path', 'safe', 'on' => 'other')); if (It::isLinux()) { $pattern = '/^[\\/]([A-Za-z0-9-_\\s\\/\\.]){1,251}$/'; //$res[] = array('scheduled_reports_path, xml_messages_path', 'match', 'pattern' => $pattern, 'on' => 'other'); } elseif (It::isWindows()) { $pattern = '/^([A-Z]{1})(:\\\\)([A-Za-z0-9-_\\s\\.]+[\\\\]?){1,251}$/'; $res[] = array('scheduled_reports_path, xml_messages_path', 'match', 'pattern' => $pattern, 'on' => 'other'); } return $res; }
public function _prepareDataPairs() { $length = strlen($this->incoming_sensor_value); $initial_time = $this->incoming_measuring_timestamp; $needed_feature = array(); foreach ($this->sensor_features_info as $feature) { if ($feature['feature_code'] == 'rain') { $needed_feature = $feature; } } $this->prepared_pairs[] = array('feature_code' => 'rain', 'period' => 1, 'value' => $this->incoming_sensor_value, 'measuring_timestamp' => $this->incoming_measuring_timestamp, 'metric_id' => $needed_feature['metric_id'], 'normilized_value' => It::convertMetric($this->incoming_sensor_value, $needed_feature['metric_code'], $needed_feature['general_metric_code'])); return true; }
function actionCheckExtraUpdate() { ini_set('memory_limit', '-1'); set_time_limit(0); // $version = getConfigValue('version'); $version = array(); $method_name = 'm_' . $version['stage'] . '_' . $version['sprint'] . '_' . $version['update']; $form = new UpdateScriptForm(); if (method_exists($form, $method_name)) { $form->{$method_name}(Yii::app()->db); It::memStatus('update__success'); } $this->redirect($this->createUrl('update/index')); //print ('<script type="text/javascript"> setTimeout(function(){document.location.href="'.Yii::app()->controller->createUrl('update/index').'"}, 500)</script>'); }
public function run($args) { if (empty($args[0])) { exit; } $logger = LoggerFactory::getFileLogger('listener/' . $args[0]); // $logger = LoggerFactory::getConsoleLogger(); $logger->log(__METHOD__ . ' args:' . print_r($args, 1)); // creates object of ProcessListen class, which duty is listening try { (new ProcessListen($logger, $args[0], $args[1], $args[2]))->run(); } catch (Exception $e) { It::sendLetter(Yii::app()->params['developer_email'], 'Problem', $e->getMessage()); } }
public function run($args) { // don't run backup at the most busy minutes if (in_array(date('i'), array('00', '01', '15', '16', '30', '31', '45', '46'))) { return; } if (Yii::app()->mutex->lock('BackupOldData', 60 * 60)) { try { $obj = new BackupOldData(); $obj->run(); } catch (Exception $e) { It::debug('BackupOldDataCommand: backup old data process was failed: ' . $e->getMessage(), 'backup_database'); } Yii::app()->mutex->unlock(); } }
public function actionImportMessage() { if (It::isGuest()) { print json_encode(array('errors' => array('Sign in first.'), 'ok' => 0)); CApplication::end(); } $message = isset($_POST['message']) ? trim($_POST['message']) : null; if ($message) { $st = time(); $settings = Settings::model()->find(); ListenerLogTemp::addNew($message, 0, $settings->overwrite_data_on_import, 'import', 0); // ListenerLog::addNew($message, 0, $settings->overwrite_data_on_import, 'import', 0); print json_encode(array('ok' => 1)); } else { print json_encode(array('ok' => 0)); } CApplication::end(); }
public function createSync() { $applicationsPaths = $this->getConfigFile('application_params'); if (TaskManager::check($this->sync_id) === false) { $command = $applicationsPaths['php_exe_path'] . " -f " . dirname(Yii::app()->request->scriptFile) . DIRECTORY_SEPARATOR . "console.php syncdb"; TaskManager::create($this->sync_id, $command, $this->sync_periodicity, $this->sync_interval, $this->sync_startTime); } if (TaskManager::check($this->db_backup_id) === false) { $backup_path = Yii::app()->params['backups_path'] . DIRECTORY_SEPARATOR . (It::isLinux() ? '`echo "$""(date +\\%a)"`' : '%DATE:~0,3%') . '_long.sql'; // Schedule daily database backup // $command = $install->getConfigSection('path','mysqldump_exe_path') . $command = $applicationsPaths['mysqldump_exe_path'] . ' --user="******"' . ' --password="******"' . ' --result-file="' . $backup_path . '" ' . $this->dbname; TaskManager::create($this->db_backup_id, $command, 'daily', 1, '4:00'); } if (TaskManager::check($this->heartbeat_id) === false) { $command = $applicationsPaths['php_exe_path'] . " -f " . dirname(Yii::app()->request->scriptFile) . DIRECTORY_SEPARATOR . "console.php heartbeatreport"; TaskManager::create($this->heartbeat_id, $command, 'minutely', 10); } }
function actionIndex() { ini_set('memory_limit', '-1'); print 'Checking `listener_log` table upgrade....<br/>'; $sql = "SHOW COLUMNS FROM `" . ListenerLog::model()->tableName() . "` LIKE 'is_last'"; $res = Yii::app()->db->createCommand($sql)->queryAll(); if (!$res) { print '<br/><br/>Checked - requires update.<br/><br/>Attention! Script going to make small update to your database.... Please, be patient, don\'t use system before script is completed.'; $sql = "ALTER TABLE `" . ListenerLog::model()->tableName() . "` ADD `is_last` tinyint(1) NOT NULL DEFAULT '0' AFTER `is_processed`"; Yii::app()->db->createCommand($sql)->query(); $sql = "SELECT * FROM `" . Station::model()->tableName() . "`"; $stations = Yii::app()->db->createCommand($sql)->queryAll(); if ($stations) { foreach ($stations as $key => $value) { ListenerLog::updateIsLastForStation($value['station_id']); } } print '<br><br>.....<br><br>Done!. <br/><br/>You can continue work with <a href="' . It::baseUrl() . '">Delairco</a>'; } else { print '<br/>Checked - doesn\'t require update. <br/><br/>You can continue work with <a href="' . It::baseUrl() . '">Delairco</a>'; } }
public function prepareFormulaParams() { $this->formula_params['h_station_above_sea'] = $this->station_obj->altitude; // h_barometer_above_station $sensor_id_codes = $this->getUsedSensors($this->station_obj->station_id); $sensor_id_code = array_shift(preg_grep('/^PR.$/', $sensor_id_codes)); $qb = new CDbCriteria(); $qb->with = ['sensor.handler', 'metric']; $qb->addCondition('sensor.sensor_id_code LIKE \'' . $sensor_id_code . '\''); $qb->addCondition('sensor.station_id = ' . $this->station_obj->station_id); $qb->addCondition('handler.handler_id_code LIKE \'Pressure\''); $qb->addCondition('t.feature_code LIKE \'height\''); $res = StationSensorFeature::model()->find($qb); $h_barometer_above_station = 0; if ($res && !is_null($res->feature_constant_value) && !is_null($res->metric->code)) { $h_barometer_above_station = It::convertMetric($res->feature_constant_value, $res->metric->code, 'meter'); } $this->formula_params['h_barometer_above_station'] = $h_barometer_above_station; // coefficient_from_station_gravity $station_gravity = floatval($this->station_obj->station_gravity); $this->formula_params['coefficient_from_station_gravity'] = ($station_gravity > 0 ? $station_gravity : array_shift(array_keys(yii::app()->params['station_gravity']))) / 0.0065 / 287; return parent::prepareFormulaParams(); }
public function prepareXMLValue($xml_data, $db_features) { if ($xml_data['wind_speed_1'][0] == 'M') { $data_1 = '3MMMM'; } else { $tmp = It::convertMetric(round($xml_data['wind_speed_1'] * 10), 'knot', $db_features['wind_speed_1']); $data_1 = "3" . str_pad(round($tmp), 4, "0", STR_PAD_LEFT); } if ($xml_data['wind_speed_2'][0] == 'M') { $data_2 = 'MMMM'; } else { $tmp = It::convertMetric(round($xml_data['wind_speed_2'] * 10), 'knot', $db_features['wind_speed_2']); $data_2 = str_pad(round($tmp), 4, "0", STR_PAD_LEFT); } $data_3 = 'MMMM'; return $data_1 . $data_2 . $data_3; }
<div class="middlenarrow"><div id="autorefreshedPageError"></div></div> <div class="middlenarrow"><div class="small" style="text-align:right;"><?php echo It::t('site_label', 'page_is_autorefreshing'); ?> </div></div> <div id="autorefreshedPpage_5min"> <?php $this->renderPartial($template, array('render_data' => $render_data)); ?> </div>
<?php if (isset($item['label'])) { ?> <li> <a class="<?php if (isset($item['active'])) { ?> active<?php } ?> " href="<?php echo Yii::app()->createUrl($controller . '/' . $action); ?> "> <?php echo It::t('menu_label', $item['label']); ?> </a> </li> <li class="delimiter"> </li> <?php } ?> <?php } ?> </ul> <div class="clear"></div> </div> </div> </div>
function checkIntegrity() { $this->_logger->log(__METHOD__); // sometimes arrived message can contain casual symbols before @ or after $ // we should strip them to work with clear message $occurances_at = strpos($this->message_obj->message, '@'); $occurances_dl = strpos($this->message_obj->message, '$'); if ($occurances_at !== false && $occurances_dl !== false) { $this->message_obj->message = substr($this->message_obj->message, $occurances_at); $len = strlen($this->message_obj->message); $occurances_dl = ($len - strpos($this->message_obj->message, '$') - 1) * -1; if ($occurances_dl) { $this->message_obj->message = substr($this->message_obj->message, 0, $occurances_dl); } } // check if arrived message - is line from Rain Datalogger's log OR is regular message $rg_log_pattern = '/^\\d{2}\\/\\d{2}\\/\\d{2},\\d{2}:\\d{2},\\d{3},\\d{0,5}$/'; if (preg_match($rg_log_pattern, $this->message_obj->message)) { $this->_message_type = 'rg_log'; $this->_type = 'rain'; } else { $this->_message_type = 'message'; } $this->_logger->log(__METHOD__ . ' Message type detected', array('type' => $this->_message_type)); // if arrived message - is regular message if ($this->_message_type == 'message') { // message must start with @ if (substr($this->message_obj->message, 0, 1) != '@') { $this->pushError('start_missed', 'Record does not start with @'); } // message must end with $ if (substr($this->message_obj->message, -1, 1) != '$') { $this->pushError('end_missed', 'Record does not end with $'); } if (!$this->errors) { // Rain DataLogger's message has R at 22nd position if (substr($this->message_obj->message, 21, 1) == 'R') { $this->_type = 'rain'; $this->_header = substr($this->message_obj->message, 0, 21); } else { $this->_type = 'aws'; $this->_header = substr($this->message_obj->message, 0, 19); } // footer - is last 8 symbols of message without first and last symbols $this->_footer = substr($this->message_obj->message, -9, -1); // crc source - is CRC code of other part of the message $compare_with_crc = substr($this->message_obj->message, 1, -9); $check_str = It::prepareCRC($compare_with_crc); if ($check_str !== $this->_footer) { $this->pushError('crc_wrong', 'CRC code is incorrect'); } } } if (!$this->errors) { // RG log line, AWS and Rain messages have different position of date and time // RG message also has battery voltage value without specific sensor // station ID is located just after date and time substrings, so we can get it by the way if ($this->_message_type == 'rg_log') { $this->_tx_date = str_replace('/', '', substr($this->message_obj->message, 0, 8)); $this->_tx_time = str_replace(':', '', substr($this->message_obj->message, 9, 5)); $this->rg_battery_voltage = substr($this->message_obj->message, 15, 3); $this->_body = substr($this->message_obj->message, 19); $this->getStation('', $this->message_obj->station_id); } else { if ($this->_type == 'aws') { // starts from 20s symbol and discards 9 symbols from end (CRC) $this->_body = substr($this->message_obj->message, 19, -9); $this->_tx_date = substr($this->message_obj->message, 7, 6); $this->_tx_time = substr($this->message_obj->message, 13, 4); $station_id = substr($this->message_obj->message, 2, 5); } else { // starts from 22d symbol and discards 9 symbols from end (CRC) $this->_body = substr($this->message_obj->message, 21, -9); $this->_tx_date = substr($this->message_obj->message, 6, 6); $this->_tx_time = substr($this->message_obj->message, 12, 4); $this->rg_battery_voltage = substr($this->message_obj->message, 16, 3); $station_id = substr($this->message_obj->message, 2, 4); } $this->getStation($station_id); } // Check length string of DATE & TIME // Good if strlen(date + time) == 6 + 4 and date + time is numeric if (empty($this->_tx_date) || empty($this->_tx_time) || strlen($this->_tx_date . $this->_tx_time) != 10 || !is_numeric($this->_tx_date . $this->_tx_time)) { $this->pushError('date_format', 'Time or date is incorrect:' . $this->_tx_date . $this->_tx_time); } } }
<?php echo CHtml::activeTextField($form, 'time_to', array('style' => 'width: 50px;')); ?> <?php echo CHtml::error($form, 'time_to'); ?> </td> <td> </td> <td class="buttons"> <input type="submit" name="filter" value="<?php echo It::t('site_label', 'do_filter'); ?> " /> <input type="submit" name="clear" value="<?php echo It::t('site_label', 'do_reset'); ?> " /> </td> </tr> </table> </form> <div class="clear"></div> </div> </div><!-- div.middlenarrow --> <div class="spacer"></div>
public static function getTypes() { return array('mail' => It::t('home_schedule', 'type_mail'), 'ftp' => It::t('home_schedule', 'type_ftp')); }
public static function parseUID($uid) { $res = explode("_", $uid); $result['check_period_start'] = It::UnixTimestampToTime($res[0]); $result['ex_schedule_ident'] = $res[1]; return $result; }
<?php $importAdminsSettings->result_success === true ? It::memStatus('admin_imports_occurred_successfully') : ""; $importAdminsSettings->result_success === false ? It::memStatus('admin_import_was_fail') : ""; ?> <div class="middlenarrow" style="padding-top: -100px"> <?php echo CHtml::errorSummary($importAdminsSettings); ?> <h1>Export settings</h1> <?php echo CHtml::beginForm($this->createUrl('superadmin/exportadminssettings'), 'post', array('id' => 'formexportadminssettings')); ?> <table class=""> <tr> <td><?php echo CHtml::activeCheckBox($exportAdminsSettings, 'user_settings'); ?> <?php echo CHtml::activeLabel($exportAdminsSettings, 'user_settings'); ?> </td> </tr> </table> <br/><br/> <?php echo CHtml::hiddenField('type', 'export'); ?>
/** * Format: NsNsNsHsHsHs or VVHsHsHs or SKC */ protected function writeSkyCodition() { $exitLoop = false; $needToCheckLayer4 = false; // for 1 to 4 for ($group = 1; $group < 5; $group++) { $cloudAmount = $this->getCloudAmount($group); $cloudHeight = $this->getCloudHeight($group); if ($group === 4 && $needToCheckLayer4 === false) { break; } if (!is_null($cloudAmount['source_value']) && $cloudAmount['source_value'] !== 'M') { $cloudInfo = null; // Layer 1 is lower than Layer 2 etc. So, check only 1st layer. if ($group === 1 && $cloudAmount['source_value'] === 0) { $cloudInfo = 'NCD'; $exitLoop = true; } else { if ($group === 1 && It::convertMetric($cloudHeight['source_value'], $cloudHeight['source_metric'], 'meter') > 1500) { $cloudInfo = 'NSC'; $exitLoop = true; } else { if ($this->getCloudAmountLimitForGroup($group) < $cloudAmount['source_value']) { $cloudInfo = $cloudAmount['value'] . $cloudHeight['value']; } else { if ($group === 3) { $needToCheckLayer4 = true; } } } } if (!is_null($cloudInfo)) { if (isset($this->report_parts[$this->_section][$this->_subsection])) { $this->report_parts[$this->_section][$this->_subsection] .= ' ' . $cloudInfo; } else { $this->report_parts[$this->_section][$this->_subsection] = $cloudInfo; } if ($exitLoop) { break; } } } $this->explanations[$this->_section][$this->_subsection][] = $cloudAmount['description']; $this->explanations[$this->_section][$this->_subsection][] = $cloudHeight['description']; } }
public static function runAsynchCommand($command) { if (It::isLinux()) { $output = null; $return = null; exec('nohup ' . $command . ' > /dev/null 2> /dev/null &', $output, $return); } else { if (It::isWindows()) { @pclose(@popen('start /B ' . $command, 'r')); } } }
<?php /** @var $form SuperAdminConfigForm */ ?> <div class="middlenarrow"> <h1><?php echo It::t('menu_label', 'superadmin_config'); ?> </h1> <?php echo CHtml::beginForm($this->createUrl('superadmin/config'), 'post'); ?> <?php echo CHtml::errorSummary($form); ?> <table class="formtable"> <?php foreach ($form->getConfig() as $config) { ?> <tr> <th><?php echo CHtml::activeLabel($form, "config[{$config->key}]"); ?> </th> <td><?php echo CHtml::activeTextField($form, "config[{$config->key}]"); ?>
/** * Deletes task by name. * * @param string $name */ public static function delete($name) { if (It::isLinux()) { exec('crontab -l | grep -v ' . $name . ' | crontab -'); } else { if (It::isWindows()) { exec('schtasks /delete /tn ' . $name . ' /f'); } } }
public function attributeLabels() { return array('station_id' => It::t('site_label', 'filter_select_stations'), 'sensor_feature_code' => It::t('site_label', 'filter_select_features'), 'date_from' => It::t('site_label', 'filter_date_from'), 'date_to' => It::t('site_label', 'filter_date_to'), 'time_from' => It::t('site_label', 'filter_time_from'), 'time_to' => It::t('site_label', 'filter_time_to'), 'accumulation_period' => It::t('site_label', 'filter_accumulation_period')); }