vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=251)
-   -   HowTo? Move / Delete Threads of one forum after x days (https://vborg.vbsupport.ru/showthread.php?t=325711)

MarkFL 10-30-2017 10:06 PM

I will run the code on my local dev site to see what I find. :)

--------------- Added [DATE]1509428993[/DATE] at [TIME]1509428993[/TIME] ---------------

Okay, this should work:

PHP Code:

global $vbulletin;
require_once(
DIR '/includes/functions_databuild.php');

$deleted 0;
$curtime TIMENOW;
$physicaldel false;
$del_user fetch_userinfo(1);
$del_forumid '4';
$reason 'Thema alt entfernt via cron.';

$delinfo = array(
    
'userid'          => $del_user['userid'],
    
'username'        => $del_user['username'],
    
'reason'          => $reason,
    
'keepattachments' => true
);

$countposts = ($vbulletin->forumcache["$del_forumid"]['options'] & $vbulletin->bf_misc_forumoptions['countposts']);

$query "SELECT thread.* FROM " TABLE_PREFIX "thread AS thread WHERE lastpost <= " . ($curtime 365*86400) . " AND forumid = " $del_forumid;

$threads_delete $vbulletin->db->query_read($query);
$mthread =& datamanager_init('Thread'$vbulletinERRTYPE_SILENT'threadpost');

while (
$thread_delete $vbulletin->db->fetch_array($threads_delete))
{
    if (!
$deleted)
    {
        
$deleted true;
    }

    
$mthread->set_existing($thread_delete);
    
$mthread->delete($countposts$physicaldel$delinfofalse);
}

unset(
$mthread);

if (
$deleted)
{
    
build_forum_counters($del_forumid);
}

$move_prefixid 'reportthread_solved';
$source_forumid 10;
$destination_forumid 12;

$vbulletin->db->query_write(
    UPDATE " 
TABLE_PREFIX "thread
        SET forumid = " 
$destination_forumid "
        WHERE forumid = " 
$source_forumid "
        AND lastpost <= " 
. ($curtime 100*86400) . "
        AND prefixid = '" 
$move_prefixid "'
"
);

build_forum_counters($source_forumid);
build_forum_counters($destination_forumid); 

--------------- Added [DATE]1509429187[/DATE] at [TIME]1509429187[/TIME] ---------------

I move that these double-post merges go away. :)

Za4a Tuner 10-31-2017 06:39 AM

Thanks for your help and spending time on my problem,
but the code from the post above won't work in my board :(
I used it, as you posted it, or have i to do some changes?

kr Chris

MarkFL 10-31-2017 01:44 PM

It should work exactly as I posted it, but it could be that you have other plugins hooked at "threaddata_delete" that are causing an issue. Do you have any plugins hooked there?

Za4a Tuner 11-01-2017 10:58 AM

Quote:

Originally Posted by MarkFL (Post 2590867)
It should work exactly as I posted it, but it could be that you have other plugins hooked at "threaddata_delete" that are causing an issue. Do you have any plugins hooked there?

in the plug-in list is nothing hooked at "threaddata_delete".

MarkFL 11-01-2017 02:50 PM

When you manually run the daily cleanup, what error(s) do you get?

Za4a Tuner 11-04-2017 06:35 PM

1 Attachment(s)
Hy,
sorry for the late answer, but i wasn't at home till now.

All the shedulded tasks even don't run!
Attachment 156714

The plugin is disabled, and the task for "daily cleanup" run:
Attachment 156715

but when i open the logfile, there is no entry for the task!
Attachment 156716

I don't know whats wrong

MarkFL 11-04-2017 07:02 PM

When you manually run the daily cleanup, what error messages do you get?

Za4a Tuner 11-04-2017 07:10 PM

this is the error message:
PHP Code:

[Sat Nov 04 21:06:43 2017] [error] [client 95.91.250.110PHP Fatal error:  Only variables can be passed by reference in .../includes/cron/dailycleanup.php(126) : eval()'d code on line 12, referer: .../admincp/cronadmin.php?do=modify 



All times are GMT. The time now is 12:53 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.02428 seconds
  • Memory Usage 1,754KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (2)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (1)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (8)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete