Anne Rice build 5

All new Coranto Addons, updates and patches to addons, will be released here...also, get support for addons within!

Moderators: Spunkmeyer, Dale Ray, SrNupsen, Bluetooth, Jackanape

Postby bozoka45 » Wed Feb 04, 2004 6:40 am

Ok, I'll look at it and see what I can fudge out, I dont know Perl but I should be able to get it.

Thanks.
User avatar
bozoka45
 
Posts: 1159
Joined: Sun Mar 23, 2003 8:38 pm
Location: New Orleans

Postby faithless » Mon Feb 23, 2004 1:25 am

plushpuffin wrote:http://www.wwddfd.com/c/cra_annerice_b6.txt

Here's a shell of what you need. I've left the guts to you, because my server was bugging out on me. Dunno why.

I think what you need to do is call modifynews_toprow hook, and then call modifysave_3 hook. This will simulate editing and saving a news item, hopefully it will be compatible with all other addons. Who knows...


Made some bug fixes as well as complete your "shell"

Code: Select all
$Subs{'AnneRiceUpdate'} = << 'END_SUB';
sub AnneRiceUpdate {
   my $addon = shift;
   NeedCFG();


   &AnneRiceLoadDB;
   $addon->pageHeader('Anne Rice Running...', 1);
   print qq~Starting Anne Rice MegaRun!<br>\n\n\n~;

   my ($fh, $fh2) = EditNewsdat_Start();

   my $stoppermnow = 0;
   ARNDLOOP: while (<$fh>) {
      $stoppermnow = 0;
      $FileCount++;
      chomp $_;
      SplitDataFile($_);

      if ($up <= 1 && $User ne $CurrentUser) {
         # User doesn't have permission for this item
         next ARNDLOOP;
      }
      # Addons: please only hook in here if you're restricting access to items based
      # on permissions. If you're filtering/searching, your hook is later.
      # HOOK: ModifyNews_Permissions
      # if($Addons{'ModifyNews_Permissions'}){my $w;foreach $w (@{$Addons{'ModifyNews_Permissions'}}){my $addon=$w->[2];eval ${$w->[0]};AErr($addon,$@)if $@;};}

      # BUG FIX: NDLOOP label not accessible from outside crcore.pl
      if ($stoppermnow == 1){
         next ARNDLOOP;
      }

      # let's make all other addons think that we're in modify news
      # first we edit, then we save. taa-daa!
      #
      # note: I have no freaking clue what effect this will have on
      # any other addons that might hook into Edit_TopRow or EditSave_3
      # I hope it doesn't do anything super bad! ;)

      print qq~Running Anne Rice on # $FileCount, $Subject / $newsid<br>\n~;

      # HOOK: ModifyNews_Edit_TopRow
      # if($Addons{'ModifyNews_Edit_TopRow'}){my $w;foreach $w (@{$Addons{'ModifyNews_Edit_TopRow'}}){my $addon=$w->[2];eval ${$w->[0]};AErr($addon,$@)if $@;};}
      eval $ModifyNews_Edit_TopRow;

      # HOOK: ModifyNews_EditSave_3
      # if($Addons{'ModifyNews_EditSave_3'}){my $w;foreach $w (@{$Addons{'ModifyNews_EditSave_3'}}){my $addon=$w->[2];eval ${$w->[0]};AErr($addon,$@)if $@;};}
      eval $AnneRice_SaveNews;

      my $newsline = JoinDataFile();
      print $fh2 $newsline, "\n";
      $ItemCount++;
      $CConfig{'LastBuildOverride'} = ($newstime - 1) if ($newstime - 1) < $CConfig{'LastBuildOverride'};
   }

   close($fh);
   close($fh2);
   EditNewsdat_Finish();

   if ($CConfig{'AutoBuild_Modify'}) {
      BuildNews();
   }
   print qq~\n\n\n<br>DONE.<br>\n~;
   $addon->pageFooter();
   exit;
}
END_SUB


I don't think addons need to run for this search and replace option.
So I just added an eval statement to run the search and save routines.

Also, I believe the $fh and $fh2 was not closed properly, thus causing some news items to be truncated on my test site. it is now closed properly with close($fh); and close($fh2);
faithless
 
Posts: 1335
Joined: Wed Oct 16, 2002 4:17 pm
Location: Infront of the Computer

Postby plushpuffin » Mon Feb 23, 2004 3:15 am

Ah, ok. Good job, faithless. Sorry about the closing of the filehandles, I never actually tested it.
I LIKE PIE
User avatar
plushpuffin
 
Posts: 411
Joined: Tue Mar 12, 2002 1:28 pm
Location: Buffalo, NY

Postby faithless » Mon Feb 23, 2004 2:51 pm

That screwed up my 2 sites badly before I found out bout the unclosed file handles. thankfully I had some backups on hand. (I can't believe I forgot to backup before trying)

some news were lost, but later swiftly restored.
faithless
 
Posts: 1335
Joined: Wed Oct 16, 2002 4:17 pm
Location: Infront of the Computer

Postby plushpuffin » Tue Feb 24, 2004 5:29 pm

:) sorry for the trouble, but as I said, it was just a skeleton, and I didn't actually test it.
I LIKE PIE
User avatar
plushpuffin
 
Posts: 411
Joined: Tue Mar 12, 2002 1:28 pm
Location: Buffalo, NY

Postby faithless » Wed Feb 25, 2004 1:39 am

plushpuffin wrote::) sorry for the trouble, but as I said, it was just a skeleton, and I didn't actually test it.

It's ok. I don't blame you. :lol:
faithless
 
Posts: 1335
Joined: Wed Oct 16, 2002 4:17 pm
Location: Infront of the Computer

Postby bozoka45 » Tue Dec 21, 2004 3:08 pm

Dont know why I never noticed this before, but now I'm trying to get this addon up and running 100%.

Have you gotten it working, faithless? It seems as though I can never get the "eval" function to run. I'm suspecting that while the addon is "working" its not going through the regexp part, which is called through eval.

Anyone have any ideas as to why eval wouldn't work?
User avatar
bozoka45
 
Posts: 1159
Joined: Sun Mar 23, 2003 8:38 pm
Location: New Orleans

Postby faithless » Tue Dec 21, 2004 3:33 pm

No idea. The above still works for me.
faithless
 
Posts: 1335
Joined: Wed Oct 16, 2002 4:17 pm
Location: Infront of the Computer

Postby bozoka45 » Tue Dec 21, 2004 3:42 pm

Its weird cause I tried using eval in my FakeSQL addon and it didn't work there either. :confused:

Time to do a little googling. Maybe my eval is broken.
User avatar
bozoka45
 
Posts: 1159
Joined: Sun Mar 23, 2003 8:38 pm
Location: New Orleans

Postby bozoka45 » Tue Dec 21, 2004 4:17 pm

Tried using this code in the same directory as Coranto and it worked fine:

Code: Select all
#!/usr/bin/perl

print "Content-type: text/html\n\n";

my $eval = << 'END_CODE';
   print "Hello!";
END_CODE

eval $eval;

1;
User avatar
bozoka45
 
Posts: 1159
Joined: Sun Mar 23, 2003 8:38 pm
Location: New Orleans

Postby faithless » Wed Dec 22, 2004 5:34 am

Check to see if you removed all the extra spaces after the lines that phpBB inserts in all pasted code, and also, check that you didn't have any line breaks where they arn't supposed to be.
faithless
 
Posts: 1335
Joined: Wed Oct 16, 2002 4:17 pm
Location: Infront of the Computer

Postby bozoka45 » Wed Dec 22, 2004 5:58 am

Doesn't look like there are any linebreaks and I trimmed all the lines.
User avatar
bozoka45
 
Posts: 1159
Joined: Sun Mar 23, 2003 8:38 pm
Location: New Orleans

Previous

Return to Addon Release and Support

Who is online

Users browsing this forum: Google [Bot], Majestic-12 [Bot] and 0 guests

cron