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)
* @class task_item
* Object that stores the parent task manager class
* @var $class
* Array that stores the task data
* @var $task
protected $task = array();
* Registry Object Shortcuts
* @var $registry
* @var $DB
* @var $lang
* @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
$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!
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.
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.
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§ion=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§ion=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.
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.
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.
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§ion=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§ion=taskmanager&do=task_unlock&task_id=55&tab=members"
Have set the following nginx variables too:
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!
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.
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.