vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB4 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=252)
-   -   Scheduled Task Help (https://vborg.vbsupport.ru/showthread.php?t=290158)

TheSupportForum 11-05-2012 01:35 AM

Scheduled Task Help
 
Hi i need support with this scheduled task

rename("$logfile/$logname", "$logfile/backup/$logname" . date("d-M-Y", time()) . ".txt");;

the issue is as follows

1) original filename from $logname is log.txt
2) after rename it become tenhbyuu.txt04-Nov-2012.txt

so what im looking for is a solutions to do

2) renamed to tenhbyuu-04-Nov-2012.txt

the reason i am using a $logname is to allow users to choose log name, i am am still looking to keep

rename("$logfile/$logname", "$logfile/backup/$logname"

in place

kh99 11-05-2012 12:41 PM

I'm not sure I follow completely - you want to remove the ".txt" from the middle of the name? Maybe something like:

Code:

rename("$logfile/$logname", "$logfile/backup/" . substr($logname, 0, -4) . '-' . date("d-M-Y", time()) . ".txt");

TheSupportForum 11-07-2012 09:33 AM

Quote:

Originally Posted by kh99 (Post 2378550)
I'm not sure I follow completely - you want to remove the ".txt" from the middle of the name? Maybe something like:

Code:

rename("$logfile/$logname", "$logfile/backup/" . substr($logname, -4) . '-' . date("d-M-Y", time()) . ".txt");

tried it, but nothing happened, it did not create any backup file

kh99 11-07-2012 12:50 PM

OK, sorry, there was a mistake in the code which I've fixed above. I think it would have created a file in the backup directory with a name starting with ".txt", which would be hidden on a linux system, so if you need that file it might still be there.

TheSupportForum 11-07-2012 12:53 PM

Quote:

Originally Posted by kh99 (Post 2379131)
OK, sorry, there was a mistake in the code which I've fixed above. I think it would have created a file in the backup directory with a name starting with ".txt", which would be hidden on a linux system, so if you need that file it might still be there.

the scheduled task is designed to remove the original, which is why i noticed before it did not work, i will try the code again now and see how it goes

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

thank you once again kh99 :)
it works now how i want it too :)


All times are GMT. The time now is 05:29 AM.

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.01122 seconds
  • Memory Usage 1,720KB
  • 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_code_printable
  • (2)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (5)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
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete