public function up() { $this->createTable('p_user', array('id' => 'pk', 'email' => 'string NOT NULL', 'username' => 'string NOT NULL', 'password' => 'string NOT NULL', 'email' => 'string NOT NULL', 'last_login' => 'datetime', 'is_deleted' => 'boolean')); $this->addAutoIncrement('p_user', 'id'); $this->insert('p_user', ['email' => "*****@*****.**", 'username' => 'dev', 'password' => Setting::get('devInstallPassword'), 'last_login' => null, 'is_deleted' => 0]); Setting::remove("devInstallPassword"); }
public function actionIndex($force = false) { $isPMRunning = null; while (true) { if (!$force) { $isPMRunning = ProcessHelper::isPMRunning(); } if (!$isPMRunning) { break; } $cmds = Setting::get('process', null, true); foreach ($cmds as $id => $cmd) { $curTime = time(); $isStillRunning = false; # Getting PID of previous process. if (isset($cmd['pid'])) { $isStillRunning = ProcessHelper::findRunningProcess($cmd['pid']); } # Remove one task kill process from Process Manager List if ($cmd['runOnce'] && !$isStillRunning) { Setting::remove('process.' . $id); } if ($cmd['runOnce']) { echo $cmd['name'] . "\n"; continue; } $isStarted = $cmd['isStarted']; # Running periodic process continously if ((!isset($cmd['lastRun']) || abs($curTime - $cmd['lastRun']) % $cmd['periodCount'] == 0) && !$isStillRunning && $isStarted && !$cmd['runOnce']) { chdir(Yii::getPathOfAlias('application')); exec("process run yiic " . $cmd['command'], $pid); $cmd['lastRun'] = $curTime; $cmd['pid'] = $pid[0]; Setting::set('process.' . $id, $cmd); // Logging // echo "[".date('d-m-Y H:i:s')."] ".$cmd['name']." is running\n"; } } sleep(1); } }
public function actionDelete($id = null) { if (isset($id)) { Setting::remove('process.' . $id); } $this->redirect(['/dev/processManager/']); }
public function setSettings($data) { #App Setting::set('app.name', $data['appName'], false); Setting::set('app.mode', $data['appMode'], false); Setting::set('app.passEncrypt', $data['appPassEncrypt'], false); #Database Setting::set('db.driver', $data['dbSys'], false); Setting::set('db.dbname', $data['dbName'], false); Setting::set('db.password', $data['dbPass'], false); Setting::set('db.host', $data['dbHost'], false); Setting::set('db.username', $data['dbUser'], false); #Repo Setting::set('repo.path', $data['repoPath'], false); #Notif $enableNotif = true; $enableNotifEmail = true; if ($data['notifEnable'] != 'ON') { $enableNotif = false; $data['notifWithEmail'] = false; } if ($data['notifWithEmail'] != 'ON') { $enableNotifEmail = false; } Setting::set('notif.enable', $enableNotif, false); Setting::set('notif.email', $enableNotifEmail, false); #Audit Trail $enableAudit = true; if ($data['auditEnable'] != 'ON') { $enableAudit = false; } Setting::set("auditTrail.enable", $enableAudit, false); if ($enableAudit) { Setting::set("auditTrail.track", $data['auditTrack'], false); } else { Setting::set("auditTrail.track", null, false); } #Email Setting::remove("email.transport"); if ($data['emailService'] == 'ses') { Setting::set("email.transport.auth.accessKeyId", $data['emailAccessKeyId'], false); Setting::set("email.transport.auth.secretAccessKey", $data['emailSecretAccessKey'], false); Setting::set("email.transport.auth.rateLimit", $data['emailRateLimit'], false); Setting::set("email.transport.auth.region", $data['emailRegion'], false); } elseif ($data['emailService'] == 'gmail') { Setting::set("email.transport.auth.user", $data['emailUser'], false); Setting::set("email.transport.auth.pass", $data['emailPass'], false); } elseif ($data['emailService'] == 'smtp') { Setting::set("email.transport.auth.user", $data['emailUser'], false); Setting::set("email.transport.auth.pass", $data['emailPass'], false); Setting::set("email.transport.host", $data['emailHost'], false); Setting::set("email.transport.port", $data['emailPort'], false); } if ($data['emailService'] != 'none') { Setting::set("email.from", $data['emailSender'], false); } else { Setting::set("email.from", null, false); } if ($data['emailService'] == 'smtp') { Setting::set("email.transport.service", null, false); } elseif ($data['emailService'] == 'none') { Setting::set("email.transport.service", 'none', false); } else { Setting::set("email.transport.service", $data['emailService'], false); } #LDAP if ($data['ldapEnable'] === 'ON') { Setting::set("ldap.enable", true, false); Setting::set("ldap.ad_port", $data['ldapAdPort'], false); Setting::set("ldap.account_suffix", $data['ldapAccountSuffix'], false); Setting::set("ldap.base_dn", $data['ldapBaseDn'], false); Setting::set("ldap.domain_controllers", $data['ldapDomainControllers'], false); Setting::set("ldap.admin_password", $data['ldapPassword'], false); Setting::set("ldap.admin_username", $data['ldapUsername'], false); } else { Setting::remove("ldap.ad_port"); Setting::remove("ldap.account_suffix"); Setting::remove("ldap.base_dn"); Setting::remove("ldap.domain_controllers"); Setting::remove("ldap.admin_password"); Setting::remove("ldap.admin_username"); Setting::set("ldap.enable", false, false); } Setting::write(); return true; }
public function actionDelete($m) { Setting::remove('services.list.' . $m); }