Beispiel #1
0
    /**

     * Upgrade this workspace database to the latest system schema

     *

     * @param bool $checkOnly only check if the upgrade is needed if true

     * @return array bool upgradeSchema for more information

     */

    public function upgradeDatabase ($onedb = false, $checkOnly = false)

    {

        G::LoadClass("patch");

        $this->initPropel( true );

        p11835::$dbAdapter = $this->dbAdapter;

        p11835::isApplicable();

        $systemSchema = System::getSystemSchema($this->dbAdapter);

        $systemSchemaRbac = System::getSystemSchemaRbac($this->dbAdapter);// get the Rbac Schema

        $this->upgradeSchema( $systemSchema );

        $this->upgradeSchema( $systemSchemaRbac, false, true, $onedb ); // perform Upgrade to Rbac

        $this->upgradeData();



        //There records in table "EMAIL_SERVER"

        $criteria = new Criteria("workflow");



        $criteria->addSelectColumn(EmailServerPeer::MESS_UID);

        $criteria->setOffset(0);

        $criteria->setLimit(1);



        $rsCriteria = EmailServerPeer::doSelectRS($criteria);



        if (!$rsCriteria->next()) {

            //Insert the first record

            $arrayData = array();



            $emailSever = new \ProcessMaker\BusinessModel\EmailServer();



            $emailConfiguration = System::getEmailConfiguration();



            if (!empty($emailConfiguration)) {

                $arrayData["MESS_ENGINE"] = $emailConfiguration["MESS_ENGINE"];



                switch ($emailConfiguration["MESS_ENGINE"]) {

                    case "PHPMAILER":

                        $arrayData["MESS_SERVER"]              = $emailConfiguration["MESS_SERVER"];

                        $arrayData["MESS_PORT"]                = (int)($emailConfiguration["MESS_PORT"]);

                        $arrayData["MESS_RAUTH"]               = (is_numeric($emailConfiguration["MESS_RAUTH"]))? (int)($emailConfiguration["MESS_RAUTH"]) : (($emailConfiguration["MESS_RAUTH"] . "" == "true")? 1 : 0);

                        $arrayData["MESS_ACCOUNT"]             = $emailConfiguration["MESS_ACCOUNT"];

                        $arrayData["MESS_PASSWORD"]            = $emailConfiguration["MESS_PASSWORD"];

                        $arrayData["MESS_FROM_MAIL"]           = (isset($emailConfiguration["MESS_FROM_MAIL"]))? $emailConfiguration["MESS_FROM_MAIL"] : "";

                        $arrayData["MESS_FROM_NAME"]           = (isset($emailConfiguration["MESS_FROM_NAME"]))? $emailConfiguration["MESS_FROM_NAME"] : "";

                        $arrayData["SMTPSECURE"]               = $emailConfiguration["SMTPSecure"];

                        $arrayData["MESS_TRY_SEND_INMEDIATLY"] = (isset($emailConfiguration["MESS_TRY_SEND_INMEDIATLY"]) && ($emailConfiguration["MESS_TRY_SEND_INMEDIATLY"] . "" == "true" || $emailConfiguration["MESS_TRY_SEND_INMEDIATLY"] . "" == "1"))? 1 : 0;

                        $arrayData["MAIL_TO"]                  = isset($emailConfiguration["MAIL_TO"]) ? $emailConfiguration["MAIL_TO"] : '';

                        $arrayData["MESS_DEFAULT"]             = (isset($emailConfiguration["MESS_ENABLED"]) && $emailConfiguration["MESS_ENABLED"] . "" == "1")? 1 : 0;

                        break;

                    case "MAIL":

                        $arrayData["MESS_SERVER"]              = "";

                        $arrayData["MESS_FROM_MAIL"]           = (isset($emailConfiguration["MESS_FROM_MAIL"]))? $emailConfiguration["MESS_FROM_MAIL"] : "";

                        $arrayData["MESS_FROM_NAME"]           = (isset($emailConfiguration["MESS_FROM_NAME"]))? $emailConfiguration["MESS_FROM_NAME"] : "";

                        $arrayData["MESS_TRY_SEND_INMEDIATLY"] = (isset($emailConfiguration["MESS_TRY_SEND_INMEDIATLY"]) && ($emailConfiguration["MESS_TRY_SEND_INMEDIATLY"] . "" == "true" || $emailConfiguration["MESS_TRY_SEND_INMEDIATLY"] . "" == "1"))? 1 : 0;

                        $arrayData["MESS_ACCOUNT"]             = "";

                        $arrayData["MESS_PASSWORD"]            = "";

                        $arrayData["MAIL_TO"]                  = (isset($emailConfiguration["MAIL_TO"]))? $emailConfiguration["MAIL_TO"] : "";

                        $arrayData["MESS_DEFAULT"]             = (isset($emailConfiguration["MESS_ENABLED"]) && $emailConfiguration["MESS_ENABLED"] . "" == "1")? 1 : 0;

                        break;

                }



                $arrayData = $emailSever->create($arrayData);

            } else {

                /*----------------------------------********---------------------------------*/

                    $arrayData["MESS_ENGINE"]   = "MAIL";

                    $arrayData["MESS_SERVER"]   = "";

                    $arrayData["MESS_ACCOUNT"]  = "";

                    $arrayData["MESS_PASSWORD"] = "";

                    $arrayData["MAIL_TO"]       = "";

                    $arrayData["MESS_DEFAULT"]  = 1;



                    $arrayData = $emailSever->create2($arrayData);

                /*----------------------------------********---------------------------------*/

            }

        }



        p11835::execute();



        return true;

    }
Beispiel #2
0
 /**
  * Upgrade this workspace database to the latest system schema
  *
  * @param bool $checkOnly only check if the upgrade is needed if true
  * @return array bool upgradeSchema for more information
  */
 public function upgradeDatabase($checkOnly = false)
 {
     G::LoadClass("patch");
     $this->initPropel(true);
     p11835::isApplicable();
     $systemSchema = System::getSystemSchema();
     $systemSchemaRbac = System::getSystemSchemaRbac();
     // obtiene el Schema de Rbac
     $this->upgradeSchema($systemSchema);
     $this->upgradeSchema($systemSchemaRbac, false, true);
     // Hace Upgrade de Rbac
     $this->upgradeData();
     p11835::execute();
     return true;
 }