1. Fabrik 3.9 has been released. If you have updated Joomla to 3.9, this is a required update.
    Dismiss Notice

Testing Scheduler | Error 500

Discussion in 'Community' started by SoilentRed, Nov 8, 2019.

  1. SoilentRed

    SoilentRed Caaan do!

    Level: Community
    I'm testing the scheduler. Having fun with it. I was able to change a 0 to a 1 running the job.
    Now I'm trying to trigger a text message, but whenever I run the cron, I'm given an error 500. I'm not sure how to go about debugging this.

    Here is my code in case ya'll have any ideas
    Code (Text):

    require __DIR__ . '/vendor/autoload.php';
    use Twilio\Rest\Client;

    // Your Account SID and Auth Token from twilio.com/console
    $account_sid = 'ACsdsfdshgjfyytgvxbcdthjgbvsfdsgbv'; // not my real sid
    $auth_token = 'fdskfdsjkfjdlksjfslkiropewriwepk'; //also fake
    // In production, these should be environment variables. E.g.:
    // $auth_token = $_ENV["TWILIO_AUTH_TOKEN"]

    // A Twilio number you own with SMS capabilities
    $twilio_number = "+19035555555";

    $client = new Client($account_sid, $auth_token);
    $client->messages->create(
        // Where to send a text message (your cell phone?)
        '+8325555555',
        array(
            'from' => $twilio_number,
            'body' => 'I sent this message in under 10 minutes!'
        )
    );
    */
    // Get the db object
    $myDb = JFactory::getDbo();

    // Build the query ? Tables names = CASE SENSITIVE
    $myQuery = $myDb->getQuery(true);

    $myQuery
          -> update('txt')
          -> set('txt.status = 1')
          -> where('txt.status = 0');

    $myDb->setQuery($myQuery);

    // Run the query
    // $found = (int)
    $myDb->execute();
    //use $myDb->query() in Joomla2.5
    // var_dump($data);
     
     
  2. troester

    troester Well-Known Member Staff Member

    Level: Community
    See in
    \plugins\fabrik_list\email\models\email.php
    \libraries\fabrik\fabrik\Helpers\sms_gateways\twilio.php
    how Fabrik is doing it.

    If you are debugging in the backend (disable the scheduled task, use the "Run" button to start) you can include debugging output and exit; in your code.
     
  3. SoilentRed

    SoilentRed Caaan do!

    Level: Community
    Dumb question:

    Is the scheduler going to run this code for each row? or do I need to loop through each row in my code?
     
  4. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    If you are running the PHP cron plugin, you have two choices. You can either specify the list youw ant to use, and the row limit, and then that list data will be in $data, in our usual grouped format ...

    Code (Text):

    foreach ($data as $group) {
       foreach ($group as $row) {
          // element are in $row->tablename___elementname
       }
    }
     
    ... or don't specify a list, and look up the data you want yourself in the database. I usually do the latter, as relying on the list data being loaded for you has a number of potential issues. Firstly, it goes through our full getData() process, including full rendering of every elements, which can be VERY expensive for large datasets. Secondly, if you have any ACL's on your list, you probably won't see all the data ... because of the way we have to do scheduled tasks in Joomla, which is running a plugin after page load, you never know what access you'll have, because you don't know who will have loaded the page when the cron happens to fire.

    -- hugh
     
  5. SoilentRed

    SoilentRed Caaan do!

    Level: Community
    Hey All,
    Thanks again for always helping. I'm still unable to debug error 500 even using the var_dump($rows);exit;

    I've copied the Fabrik method (from public_html/components/com_fabrik/helpers/sms_gateways/twilio.php) of sending the texts and I had to modify it because I'm not pulling data from fabrik options, I'm putting it directly in the code. I may have messed up there, but I don't see how.

    I've slowly added bits of code piece by piece and the error seems to occur when "class Twilio extends JObject" is thrown into the mix. In fact, I even threw that in and wrapped it around nothing and i still go the error. As I'm sure you've all surmised by now, I'm no php guru... but that's why I use fabrik in the first place.

    Anywho, if you all can give me some feedback (again) I'd much appreciate it.

    Thank you!

    Code (Text):


    /**
     * Twilio SMS gateway class
     *
     * @package     Joomla.Plugin
     * @subpackage  Fabrik.form.sms
     * @copyright   Copyright (C) 2005-2016  Media A-Team, Inc. - All rights reserved.
     * @license     GNU/GPL http://www.gnu.org/copyleft/gpl.html
     */

    // No direct access
    defined( '_JEXEC' )or die( 'Restricted access' );

    $myDb = JFactory::getDbo();
    $myQuery = $myDb->getQuery( true );
    $myDb->setQuery( 'SELECT * FROM txt WHERE txt.status = 1' );
    $rows = $myDb->loadObjectList();
    foreach ( $rows as $row ) {
      $fname = $row->f_name;
      $lname = $row->l_name;
      $fullname = $row->full_name;
      $message = $row->message;
      $datetime = $row->scheduled_datetime;
      $company = $row->company;
      $agentid = $row->agent_id;
      $subject = $row->subject;
      $status = $row->status;


      /**
       * Twilio SMS gateway class
       *
       * @package     Joomla.Plugin
       * @subpackage  Fabrik.form.sms
       * @since       3.0
       */

    class Twilio extends JObject {
        /*
         * Send SMS
         *
         * @param   string  $message  sms message
         * @param   array   $opts     options
         *
         * @return  void
         */

        public function process( $message = '', $opts ) {
          $username = 8d8d900dkfnfe09wi0sdjiokjvjw0w9dijvpkls'; // FArrayHelper::getValue($opts, 'sms-username');
          $token = 'buf9w8iudsj0viowio998909ydghibjsk'; // FArrayHelper::getValue($opts, 'sms-password');
          $smsto = $row->mobile; // FArrayHelper::getValue($opts, 'sms-to');

          // From a valid Twilio number
          $smsfrom = '+19035555555'; // FArrayHelper::getValue($opts, 'sms-from');
          // $smstos = explode(",", $smsto);

          $client = new Twilio\ Rest\ Client( $username, $token );

          // foreach ($smstos as $smsto)
          // {
          try {
            $call = $client->messages->create(
              $smsto,
              array(
                'From' => $smsfrom,
                'Body' => $message
              )
            );
          } catch ( SException $e ) {
            JFactory::getApplication()->enqueueMessage( 'TWILIO_ERROR' );
            return false;
          }
          // }

          return true;
        }
      }
    }

    var_dump($rows);exit;
     
     
  6. cheesegrits

    cheesegrits Support Gopher Staff Member

    Level: Community
    Hmm. Yeah, not even close. :)

    Try this:

    Code (Text):

    // load the Fabrik Twilio helper class and instantiate it
    require_once JPATH_ROOT . '/libraries/fabrik/fabrik/Helpers/sms_gateways/twilio.php';
    $gateway = new Twilio();

    // set up the authentication opts
    $opts = array(
       'sms-username' => "your twilio username",
       'sms-password' => "your twilio token",
       'sms-from' => "your valid twilio sending number"
    );

    // load table rows
    $myDb = JFactory::getDbo();
    $myQuery = $myDb->getQuery( true );
    $myQuery->select( '*')
       ->from('txt')
       ->where('status = 1' );
    $rows = $myDb->loadObjectList();

    // loop around rows, sending $row->message to $row->mobile
    foreach ( $rows as $row ) {
       $opts['sms-to'] = $row->mobile;
       $gateway->process($row->message, $opts);
    }
     
    May not work right away, as I'm writing that off the top of my head without testing it, but it should be close.

    The only things you'll need to change are the authentication opts.

    Oh, and if that is your real Twilio token in your previous message, I'd edit that and remove it if I was you.


    -- hugh
     
  7. SoilentRed

    SoilentRed Caaan do!

    Level: Community
    HUGH! thank you for the quick response. Nah, those aren't my creds, just a bunch of garpledeegook. I'm all over this. Again, a billion thanks.
     
  8. SoilentRed

    SoilentRed Caaan do!

    Level: Community
    Here's a wacky result. I have no clue why this is happening, but at first I was getting a notice that the message was empty, so I started doing the vardump thing and the stuff in my query was returning NULL. So I did a dump on $rows and it gave me this:

    Code (Text):

    array(203) { [0]=> object(stdClass)#1503 (2) { ["namekey"]=> string(5) "level" ["value"]=> string(10) "Enterprise" }
    [1]=> object(stdClass)#1504 (2) { ["namekey"]=> string(7) "version" ["value"]=> string(6) "5.10.4" }
    [2]=> object(stdClass)#1505 (2) { ["namekey"]=> string(9) "from_name" ["value"]=> string(17) "BLAH" }
    [3]=> object(stdClass)#1506 (2) { ["namekey"]=> string(10) "from_email" ["value"]=> string(24) "info@blah.com" }
    [4]=> object(stdClass)#1507 (2) { ["namekey"]=> string(13) "mailer_method" ["value"]=> string(4) "smtp" }
    [5]=> object(stdClass)#1508 (2) { ["namekey"]=> string(13) "sendmail_path" ["value"]=> string(18) "/usr/sbin/sendmail" }
    [6]=> object(stdClass)#1509 (2) { ["namekey"]=> string(12) "smtp_secured" ["value"]=> string(3) "ssl" }
    [7]=> object(stdClass)#1510 (2) { ["namekey"]=> string(9) "smtp_auth" ["value"]=> string(1) "1" }
    [8]=> object(stdClass)#1511 (2) { ["namekey"]=> string(13) "smtp_username" ["value"]=> string(24) "info@blah.com" }
    [9]=> object(stdClass)#1512 (2) { ["namekey"]=> string(13) "smtp_password" ["value"]=> string(37) " 12112122-1211-2122-1211-121121221211" }
    [10]=> object(stdClass)#1513 (2) { ["namekey"]=> string(10) "reply_name" ["value"]=> string(17) "BLAH" }
    [11]=> object(stdClass)#1514 (2) { ["namekey"]=> string(11) "reply_email" ["value"]=> string(24) "info@blah.com" }
    [12]=> object(stdClass)#1515 (2) { ["namekey"]=> string(11) "cron_sendto" ["value"]=> string(16) "info@blah.com" }
    [13]=> object(stdClass)#1516 (2) { ["namekey"]=> string(12) "bounce_email" ["value"]=> string(26) "bounce@blah.com" }
    [14]=> object(stdClass)#1517 (2) { ["namekey"]=> string(9) "add_names" ["value"]=> string(1) "1" }
    [15]=> object(stdClass)#1518 (2) { ["namekey"]=> string(15) "encoding_format" ["value"]=> string(4) "8bit" }
    [16]=> object(stdClass)#1519 (2) { ["namekey"]=> string(7) "charset" ["value"]=> string(5) "UTF-8" }
    [17]=> object(stdClass)#1520 (2) { ["namekey"]=> string(13) "word_wrapping" ["value"]=> string(3) "150" }
    [18]=> object(stdClass)#1521 (2) { ["namekey"]=> string(8) "hostname" ["value"]=> string(0) "" }
    [19]=> object(stdClass)#1522 (2) { ["namekey"]=> string(12) "embed_images" ["value"]=> string(1) "0" }
    [20]=> object(stdClass)#1523 (2) { ["namekey"]=> string(11) "embed_files" ["value"]=> string(1) "1" }
    [21]=> object(stdClass)#1524 (2) { ["namekey"]=> string(6) "editor" ["value"]=> string(9) "arkeditor" }
    [22]=> object(stdClass)#1525 (2) { ["namekey"]=> string(13) "multiple_part" ["value"]=> string(1) "1" }
    [23]=> object(stdClass)#1526 (2) { ["namekey"]=> string(9) "smtp_host" ["value"]=> string(23) "smtp25.elasticemail.com" }
    [24]=> object(stdClass)#1527 (2) { ["namekey"]=> string(9) "smtp_port" ["value"]=> string(3) "465" }
    [25]=> object(stdClass)#1528 (2) { ["namekey"]=> string(12) "queue_nbmail" ["value"]=> string(3) "750" }
    [26]=> object(stdClass)#1529 (2) { ["namekey"]=> string(17) "queue_nbmail_auto" ["value"]=> string(4) "1000" }
    [27]=> object(stdClass)#1530 (2) { ["namekey"]=> string(10) "queue_type" ["value"]=> string(4) "auto" }
    [28]=> object(stdClass)#1531 (2) { ["namekey"]=> string(9) "queue_try" ["value"]=> string(1) "3" }
    [29]=> object(stdClass)#1532 (2) { ["namekey"]=> string(11) "queue_pause" ["value"]=> string(3) "120" }
    [30]=> object(stdClass)#1533 (2) { ["namekey"]=> string(13) "allow_visitor" ["value"]=> string(1) "1" }
    [31]=> object(stdClass)#1534 (2) { ["namekey"]=> string(20) "require_confirmation" ["value"]=> string(1) "0" }
    [32]=> object(stdClass)#1535 (2) { ["namekey"]=> string(19) "priority_newsletter" ["value"]=> string(1) "3" }
    [33]=> object(stdClass)#1536 (2) { ["namekey"]=> string(12) "allowedfiles" ["value"]=> string(102) "zip,doc,docx,pdf,xls,txt,gzip,rar,jpg,gif,xlsx,pps,csv,bmp,ico,odg,odp,ods,odt,png,ppt,swf,xcf,mp3,wma" }
    [34]=> object(stdClass)#1537 (2) { ["namekey"]=> string(12) "uploadfolder" ["value"]=> string(27) "media/com_acymailing/upload" }
    [35]=> object(stdClass)#1538 (2) { ["namekey"]=> string(16) "confirm_redirect" ["value"]=> string(0) "" }
    [36]=> object(stdClass)#1539 (2) { ["namekey"]=> string(20) "subscription_message" ["value"]=> string(1) "1" }
    [37]=> object(stdClass)#1540 (2) { ["namekey"]=> string(21) "notification_unsuball" ["value"]=> string(0) "" }
    [38]=> object(stdClass)#1541 (2) { ["namekey"]=> string(9) "cron_next" ["value"]=> string(10) "1574283602" }
    [39]=> object(stdClass)#1542 (2) { ["namekey"]=> string(20) "confirmation_message" ["value"]=> string(1) "1" }
    [40]=> object(stdClass)#1543 (2) { ["namekey"]=> string(15) "welcome_message" ["value"]=> string(1) "1" }
    [41]=> object(stdClass)#1544 (2) { ["namekey"]=> string(13) "unsub_message" ["value"]=> string(1) "1" }
    [42]=> object(stdClass)#1545 (2) { ["namekey"]=> string(9) "cron_last" ["value"]=> string(10) "1574283002" }
    [43]=> object(stdClass)#1546 (2) { ["namekey"]=> string(11) "cron_fromip" ["value"]=> string(14) "109.321.32.321" }
    [44]=> object(stdClass)#1547 (2) { ["namekey"]=> string(11) "cron_report" ["value"]=> string(658) "AcyMailing Triggered at 20 November 2019 14:50 2 messages processed : 2 successful,yadda uadaa yadaa" }
    [45]=> object(stdClass)#1548 (2) { ["namekey"]=> string(14) "cron_frequency" ["value"]=> string(3) "600" }
    [46]=> object(stdClass)#1549 (2) { ["namekey"]=> string(15) "cron_sendreport" ["value"]=> string(1) "0" }
    [47]=> object(stdClass)#1550 (2) { ["namekey"]=> string(15) "cron_fullreport" ["value"]=> string(1) "1" }
    [48]=> object(stdClass)#1551 (2) { ["namekey"]=> string(15) "cron_savereport" ["value"]=> string(1) "2" }
    [49]=> object(stdClass)#1552 (2) { ["namekey"]=> string(13) "cron_savepath" ["value"]=> string(50) "media/com_acymailing/logs/report{year}_{month}.log" }
    [50]=> object(stdClass)#1553 (2) { ["namekey"]=> string(20) "notification_created" ["value"]=> string(51) "blah@blah.com, info@blah.com" }
    [51]=> object(stdClass)#1554 (2) { ["namekey"]=> string(19) "notification_accept" ["value"]=> string(0) "" }
    [52]=> object(stdClass)#1555 (2) { ["namekey"]=> string(19) "notification_refuse" ["value"]=> string(0) "" }
    [53]=> object(stdClass)#1556 (2) { ["namekey"]=> string(7) "forward" ["value"]=> string(1) "0" }
    [54]=> object(stdClass)#1557 (2) { ["namekey"]=> string(19) "description_starter" ["value"]=> string(31) "Joomla!™ Newsletter Extension" }
    [55]=> object(stdClass)#1558 (2) { ["namekey"]=> string(21) "description_essential" ["value"]=> string(28) "Joomla!™ Newsletter System" }
    [56]=> object(stdClass)#1559 (2) { ["namekey"]=> string(20) "description_business" ["value"]=> string(28) "Joomla!™ Newsletter System" }
    [57]=> object(stdClass)#1560 (2) { ["namekey"]=> string(22) "description_enterprise" ["value"]=> string(29) "Joomla!™ Marketing Campaign" }
    [58]=> object(stdClass)#1561 (2) { ["namekey"]=> string(17) "priority_followup" ["value"]=> string(1) "2" }
    [59]=> object(stdClass)#1562 (2) { ["namekey"]=> string(14) "unsub_redirect" ["value"]=> string(0) "" }
    [60]=> object(stdClass)#1563 (2) { ["namekey"]=> string(11) "show_footer" ["value"]=> string(1) "1" }
    [61]=> object(stdClass)#1564 (2) { ["namekey"]=> string(7) "use_sef" ["value"]=> string(1) "0" }
    [62]=> object(stdClass)#1565 (2) { ["namekey"]=> string(6) "itemid" ["value"]=> string(1) "0" }
    [63]=> object(stdClass)#1566 (2) { ["namekey"]=> string(10) "css_module" ["value"]=> string(7) "default" }
    [64]=> object(stdClass)#1567 (2) { ["namekey"]=> string(12) "css_frontend" ["value"]=> string(7) "default" }
    [65]=> object(stdClass)#1568 (2) { ["namekey"]=> string(11) "css_backend" ["value"]=> string(0) "" }
    [66]=> object(stdClass)#1569 (2) { ["namekey"]=> string(18) "bootstrap_frontend" ["value"]=> string(1) "2" }
    [67]=> object(stdClass)#1570 (2) { ["namekey"]=> string(13) "menu_position" ["value"]=> string(5) "above" }
    [68]=> object(stdClass)#1571 (2) { ["namekey"]=> string(13) "unsub_reasons" ["value"]=> string(72) "a:2:{i:0;s:21:"UNSUB_SURVEY_FREQUENT";i:1;s:21:"UNSUB_SURVEY_RELEVANT";}" }
    [69]=> object(stdClass)#1572 (2) { ["namekey"]=> string(15) "installcomplete" ["value"]=> string(1) "1" }
    [70]=> object(stdClass)#1573 (2) { ["namekey"]=> string(7) "Starter" ["value"]=> string(1) "0" }
    [71]=> object(stdClass)#1574 (2) { ["namekey"]=> string(9) "Essential" ["value"]=> string(1) "1" }
    [72]=> object(stdClass)#1575 (2) { ["namekey"]=> string(8) "Business" ["value"]=> string(1) "2" }
    [73]=> object(stdClass)#1576 (2) { ["namekey"]=> string(10) "Enterprise" ["value"]=> string(1) "3" }
    [74]=> object(stdClass)#1577 (2) { ["namekey"]=> string(7) "website" ["value"]=> string(32) "https://www.blah.com/" }
    [75]=> object(stdClass)#1578 (2) { ["namekey"]=> string(18) "max_execution_time" ["value"]=> string(3) "480" }

    There are several more rows, but I removed them due to your character limit on posts...

     
    That's a whole lotta acymailing/acysms stuff... none of which is referenced in anything we're doing here... What gives yo?
     
  9. SoilentRed

    SoilentRed Caaan do!

    Level: Community
    I thought the naming of my table as txt might be problematic, so I copied the elements to a new table, afab_smsq and I started passing the data to this table. The problem persists. The only other thing I can think of is that the form passing data to afab_smsq uses onafterprocess to query #__acymailing_subscriber and #__acymailing_listsub... but I don't see why the scheduler would return the kind of data that it did with $rows.

    Code (Text):

    $myDb = JFactory::getDbo();
    $myQuery = $myDb->getQuery( true );

    $selection = '{sms___which_groups_raw}';
    $sels = explode( ",", $selection );
    $bad_symbols = array( ",", ".", "-", " " );
    // $list = array();

    // start building the query ..
    $myQuery->insert( 'afab_smsq' );
    $myQuery->columns(
      array(
        $myDb->quoteName( 'date_time' ),
        $myDb->quoteName( 'f_name' ),
        $myDb->quoteName( 'l_name' ),
        $myDb->quoteName( 'full_name' ),
        $myDb->quoteName( 'message' ),
        $myDb->quoteName( 'scheduled_datetime' ),
        $myDb->quoteName( 'company' ),
        $myDb->quoteName( 'subject' ),
        $myDb->quoteName( 'agent_id' ),
        $myDb->quoteName( 'mobile' ),
        $myDb->quoteName( 'status' )
      )
    );
    foreach ( $sels as $sel ) {
      $insel = ( int )$sel;
      $myDb->setQuery( 'SELECT cell_phone, userid, name, first_name, last_name, organization FROM #__acymailing_subscriber JOIN #__acymailing_listsub ON #__acymailing_subscriber.subid = #__acymailing_listsub.subid WHERE #__acymailing_listsub.listid = ' . $insel . '' );
      $rows = $myDb->loadObjectList();
      foreach ( $rows as $row ) {
        $cellphone = str_replace( $bad_symbols, "", $row->cell_phone );
        if ( empty( $cellphone ) ) {
        } else {

          $myQuery->values(
            implode( ',',
              array(
                $myDb->quote( '{sms___date_time}' ),
                $myDb->quote($row->first_name),
                $myDb->quote($row->last_name),
                $myDb->quote($row->name),
                $myDb->quote( '{sms___message}' ),
                $myDb->quote( '{sms___scheduled_datetime}' ),
                $myDb->quote($row->organization),
                $myDb->quote( '{sms___subject}' ),
                $myDb->quote( '{sms___nia_agent_id}' ),
                $myDb->quote($cellphone),
                0
              )
            )
          );
        }
      }
    }
      // run the query
      $myDb->setQuery( $myQuery );
      // uncomment this line if you need to debug
      // var_dump($myQuery);exit;
      $myDb->execute();
     
     
  10. SoilentRed

    SoilentRed Caaan do!

    Level: Community
    Soooo.... when I run a vardump on $myquery, i get this

    Code (Text):

    object(JDatabaseQueryMysqli)#1933 (25) {
    ["offset":protected]=> NULL
    ["limit":protected]=> NULL
    ["db":protected]=> object(JDatabaseDriverMysqli)#22 (23) {
    ["name"]=> string(6) "mysqli"
    ["serverType"]=> string(5) "mysql"
    ["connection":protected]=> object(mysqli)#23 (19) {
    ["affected_rows"]=> int(203)
    ["client_info"]=> string(79) "mysqlnd 5.0.12-dev - 20150407 - $Id: dflkjfsdlfsdlkfsdlkjfsd $"
    ["client_version"]=> int(50012)
    ["connect_errno"]=> int(0)
    ["connect_error"]=> NULL
    ["errno"]=> int(0)
    ["error"]=> string(0) ""
    ["error_list"]=> array(0) { }
    ["field_count"]=> int(2)
    ["host_info"]=> string(25) "Localhost via UNIX socket"
    ["info"]=> NULL
    ["insert_id"]=> int(0)
    ["server_info"]=> string(15) "5.6.36-82.1-log"
    ["server_version"]=> int(50636)
    ["stat"]=> string(148) "Uptime: 169592 Threads: 3 Questions: 11504724 Slow queries: 152 Opens: 25647 Flush tables: 1 Open tables: 2048 Queries per second avg: 67.837"
    ["sqlstate"]=> string(5) "00000"
    ["protocol_version"]=> int(10)
    ["thread_id"]=> int(186799)
    ["warning_count"]=> int(0) }
    ["nameQuote":protected]=> string(1) "`"
    ["nullDate":protected]=> string(19) "0000-00-00 00:00:00"
    ["_database":"JDatabaseDriver":private]=> string(13) "dtabase_j3db"
    ["count":protected]=> int(26)
    ["cursor":protected]=> NULL
    ["debug":protected]=> bool(false)
    ["limit":protected]=> int(0)
    ["log":protected]=> array(0) { }
    ["timings":protected]=> array(0) { }
    ["callStacks":protected]=> array(0) { }
    ["offset":protected]=> int(0)
    ["options":protected]=> array(9) {
    ["driver"]=> string(6) "mysqli"
    ["host"]=> string(9) "localhost"
    ["user"]=> string(13) "dtabase_j3du"
    ["password"]=> string(18) "lkjfsdlkjfsdlkjfslkjfsdlkj"
    ["database"]=> string(13) "dtabase_j3db"
    ["prefix"]=> string(6) "b8r9o_"
    ["select"]=> bool(true)
    ["port"]=> int(3306)
    ["socket"]=> NULL }
    ["sql":protected]=> string(34) "SELECT * FROM #__acymailing_config"
    ["tablePrefix":protected]=> string(6) "b8r9o_"
    ["utf":protected]=> bool(true)
    ["utf8mb4":protected]=> bool(true)
    ["errorNum":protected]=> int(0)
    ["errorMsg":protected]=> string(0) ""
    ["transactionDepth":protected]=> int(0)
    ["disconnectHandlers":protected]=> array(0) { } }
    ["sql":protected]=> NULL
    ["type":protected]=> string(6) "select"
    ["element":protected]=> NULL
    ["select":protected]=> object(JDatabaseQueryElement)#1937 (3) {
    ["name":protected]=> string(6) "SELECT"
    ["elements":protected]=> array(1) {
    [0]=> string(98) "status, mobile, subject, agent_id, company, message, full_name, l_name, f_name, scheduled_datetime" }
    ["glue":protected]=> string(1) "," }
    ["delete":protected]=> NULL
    ["update":protected]=> NULL
    ["insert":protected]=> NULL
    ["from":protected]=> object(JDatabaseQueryElement)#1925 (3) {
    ["name":protected]=> string(4) "FROM"
    ["elements":protected]=> array(1) {
    [0]=> string(9) "afab_smsq" }
    ["glue":protected]=> string(1) "," }
    ["join":protected]=> NULL
    ["set":protected]=> NULL
    ["where":protected]=> object(JDatabaseQueryElement)#1921 (3) {
    ["name":protected]=> string(5) "WHERE"
    ["elements":protected]=> array(1) {
    [0]=> string(10) "status = 1" }
    ["glue":protected]=> string(5) " AND " }
    ["group":protected]=> NULL
    ["having":protected]=> NULL
    ["columns":protected]=> NULL
    ["values":protected]=> NULL
    ["order":protected]=> NULL
    ["autoIncrementField":protected]=> NULL
    ["call":protected]=> NULL
    ["exec":protected]=> NULL
    ["union":protected]=> NULL
    ["unionAll":protected]=> NULL
    ["selectRowNumber":protected]=> NULL }
     
    So I guess the fabrik cron is triggering all of my crons at once? even so I don't know why may vardumps for things like name and message are empty...
     
  11. troester

    troester Well-Known Member Staff Member

    Level: Community
    You should remove these data, it's showing your DB access.

    I think with
    echo $myQuery;exit;
    you'll get the query string.

    Yes, if you don't define "Require query string" and an individual "Query Secret"
     
  12. SoilentRed

    SoilentRed Caaan do!

    Level: Community
    I omitted sensitive info from that last post. just leaned into my keyboard for things...

    Looks like I had to use
    Code (Text):

    $myDb->setQuery( 'SELECT * FROM afab_smsq WHERE status = 1' );
     
    instead of
    Code (Text):

    $myDb->select( 'status, mobile, subject, agent_id, company, message, full_name, l_name, f_name, scheduled_datetime')
       ->from('afab_smsq')
       ->where('status = 1' );
     
    For whatever reason $myDb->select was triggering stuff from my other cron tasks. I'm stil unclear why. In any case, hugh corrected my original setQuery method with select. is there a reason that ->select is better than ->setquery? If it's better I'll switch back and keep debugging, but for now the setquery method seems to work.
     

Share This Page