Jason P.

+Clients
  • Content count

    5
  • Joined

  • Last visited


About Jason P.

  • Rank
    IPB Newbie

Profile Information

  • Gender Male

Jason P.'s Activity

  1. Jason P. added a post in a topic: Updating a custom IP.Content database via a scheduled task   

     
    Yep! Rather than using PHP to connect to db, run SQL, and disconnect, I just used IPBs built in Database kernel. Since the ccs_custom_database_5 is simply a table within the IPB database, you don't even need to have it establish a connection. Rather use the class to create a new DB instance and then use built in functions to run queries. Take a look at :  https://www.invisionpower.com/support/guides/_/advanced-and-developers/api-methods/kernel-databases-classdbphp-r166
     
    Particularly at the update function and how to use it (i.e. the SET part is an array, the WHERE part is a string). Here is an example I quickly through together that you could build off of: (didn't test it)
     

    <?php /** * * @class        task_item * @brief         * * */ class task_item {     /**      * Object that stores the parent task manager class      *      * @var        $class      */     protected $class;     /**      * Array that stores the task data      *      * @var        $task      */     protected $task = array();     /**      * Registry Object Shortcuts      *      * @var        $registry      * @var        $DB      * @var        $lang      */     protected $registry;     protected $DB; protected $lang;     /**      * Constructor      *      * @param    object        $registry        Registry object      * @param    object        $class            Task manager class object      * @param    array        $task            Array with the task data      * @return    @e void      */     public function __construct( ipsRegistry $registry, $class, $task )     {         /* Make registry objects */         $this->registry    = $registry;         $this->DB        = $registry->DB(); $this->lang        = $this->registry->getClass('class_localization');         $this->class    = $class;         $this->task        = $task;     }     /**      * Run this task      *      * @return    @e void      */     public function runTask()     {         //-----------------------------------------         // Here is where you perform your task         //----------------------------------------- $table = "ccs_custom_database_5";                      // going to make sure the table actually exists in the database if ($this->DB->checkForTable($table))         {             $this->DB->update($table, array ( 'record_static_furl' => 'record_dynamic_furl' ), "field_26='usa' AND record_static_furl=''");             }         }         //-----------------------------------------         // Save task log         //-----------------------------------------         $this->class->appendTaskLog( $this->task, $this->lang->words['my_task_log_lang_string'] );         //-----------------------------------------         // Unlock Task: REQUIRED!         //-----------------------------------------         $this->class->unlockTask( $this->task );     } }  
    Let me know if you have any questions!
  2. Jason P. added a post in a topic: Updating a custom IP.Content database via a scheduled task   

    I have managed to put together what I wanted using IPBs task scheduler and just the IPB Database Kernel class to manually update the database.
     
    Resolved!
  3. Jason P. added a post in a topic: Updating a custom IP.Content database via a scheduled task   

    Hi,
     
    I am trying to put something together that involves updating fields in database records automatically. I am familiar with using IPB's scheduled task system but am hoping on some guidance as to what the best route is to take. I could probably use IPBs database functions (i.e. $this->DB->build) to generate raw SQL queries that directly edit the custom database (in this case, the table ccs_custom_database_4) but am wondering if there are already built-in IP.Content functions that take care of any caching, etc. that may need to be performed. 
     
    I appreciate any help or guidance, thank you!
  4. Jason P. added a post in a topic: Steam Profile Integration   

     
    PM'd.
  5. Jason P. added a post in a topic: Steam Profile Integration   

     
    Increased to 200M and still getting 32 exceeded. Do you think this is related to why the previously cached steam profiles are no longer showing on the forums? Or does it always clear the template cache on upgrade.
  6. Jason P. added a post in a topic: Steam Profile Integration   

     
    That is disabled on my end. I lowered the users to fetch even more as well. The thing that is peculiar is that the error shows this:  tried to allocate 32 bytes
     
    Which is clearly less than the maximum O_O.
  7. Jason P. added a post in a topic: Steam Profile Integration   

    Updated from 1.0.4 to 1.1.0 by uploading files and installing hook. It seems all cached steam profile data for users has been removed. I went and tried to manually run the scheduler task and was redirected to just a blank page. Nothing in SQL error logs, but I found this error:
    2014/02/12 15:46:01 [error] 22038#0: *2993093 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 32 bytes) in /srv/joinsg/www/htdocs/ips_kernel/classDbMysqliClient.php on line 471" while reading response header from upstream, client: , server: www.joinsg.net, request: "GET /admin/index.php?adsess=7bd308c9ea92bb757ca50bae84e7fb85&app=core&module=system&section=taskmanager&do=task_run_now&task_id=55&tab=members HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.joinsg.net", referrer: "http://www.joinsg.net/admin/index.php?adsess=7bd308c9ea92bb757ca50bae84e7fb85&app=core&module=system&section=taskmanager&do=task_unlock&task_id=55&tab=members" Any ideas? It worked fine on the previous version. I even tried lowering the number of users to update at once to 15 and still get the same thing.
  8. Jason P. added a post in a topic: Steam Profile Integration   

    I've been getting this error after upgrading to 1.0.4.
     
     
     
    The fix about line 141 above didn't work (just gave me an error about no tables found m.). But what I think DID work was adding a space before AND as below (line 143):
     
     
     
    The space between " and AND seems to fix the MySQL syntax when running. The task works now when manually running, but I will have to wait and see if it does update steam profiles or not. Will report back.
     
    Edit: Yep, everything seems to be updating just fine now.
  9. Jason P. added a post in a topic: Steam Profile Integration   

    Also, I hope you don't mind, but I just tweaked the MySQL query in the task file to only select for users that have visited the forums in the past 3 days. We have 400+ people with SteamIDs connected to their account and by doing this it limits the update to only ~50-60 a run. Takes around 10-15 minutes each, however. Increased the duration between tasks to 20 minutes.
  10. Jason P. added a post in a topic: Steam Profile Integration   

     
    Ah ok I see! Darn Steam. Thank you for your response, I hope you get feeling better soon!
  11. Jason P. added a post in a topic: Steam Profile Integration   

    Just installed the plugin for our community as well. Running into time-out issues. Luckily we host ourselves, so I can change some PHP vars around. Would be nice to be able to run the scheduler in batches though. Will probably have ~100 users with steam profiles at first. 
     
    Running into 504 Gateway timeouts though. Tried to increase timeout variables, but no avail. Receive timeout error after 60 seconds.
    2013/12/14 09:40:46 [error] 24107#0: *10777489 upstream timed out (110: Connection timed out) while reading response header from upstream, client: XX.XX.XX.XX, server: www.joinsg.net, request: "GET /admin/index.php?adsess=4fadf530686c710fb4634ac9b3c16b11&app=core&module=system&section=taskmanager&do=task_run_now&task_id=55&tab=members HTTP/1.1", upstream: "fastcgi://127.0.0.1:9000", host: "www.joinsg.net", referrer: "http://www.joinsg.net/admin/index.php?adsess=4fadf530686c710fb4634ac9b3c16b11&app=core&module=system&section=taskmanager&do=task_unlock&task_id=55&tab=members" Have set the following nginx variables too:
    fastcgi_send_timeout 300 fastcgi_read_timeout 300 client_header_timeout 300 client_body_timeout 300 send_timeout 300 My PHP.ini has max_execution_time set to 300 as well. Still times out after 60 seconds.. Would really love to get this hook working, it looks awesome!
     
     
    EDIT:
     
    Well stupid me forgot to put ';' characters at the end of the nginx vars. Doesn't time out at 60 seconds anymore. I believe it was the fastcgi_read_timeout var that was causing the issue. 
     
    DOUBLE EDIT:
     
    This is taking way too long to run the scheduled task to be useful. It seems like it is running SQL queries for every single user on the forums rather than just pulling those that have a steamid from the Steam Login plugin. Could it just be set up to have a query that first selects members that actually have a steam id (meaning they used steam login to connect to the forums), then do the steam profile data parsing stuff? I would really love to use this feature on our forums, but in its current state it is cannot work.
  12. Jason P. added a post in a topic: Limiting a user's posts   

    Yeah I was able to find the limit per 24hours, however that's a bigger time stretch than I want. I'll perhaps code something up myself or search and see if there's an addon that has a similar feature.
     
    Thanks for your help.
  13. Jason P. added a post in a topic: Limiting a user's posts   

    I want to limit one specific member to only being able to post once per hour. What is the easiest way to do this?
  14. Jason P. added a post in a topic: > Prefixing links   

    I do have some js code I added not too long ago. Where can I move it to?
  15. Jason P. added a post in a topic: > Prefixing links   

    Both fields are empty. I can't think of any hooks we have that do anything with links.
     
    Recached as you suggested and problem still exists.

About Me

Status Feed