[livejournal] r23552: LJSUP-14842: Need to add some functions ...
Committer: akanashin
LJSUP-14842: Need to add some functions to S2U trunk/bin/upgrading/s2layers/core1.s2 U trunk/cgi-bin/LJ/S2.pm
Modified: trunk/bin/upgrading/s2layers/core1.s2
===================================================================
--- trunk/bin/upgrading/s2layers/core1.s2 2013-01-17 08:54:41 UTC (rev 23551)
+++ trunk/bin/upgrading/s2layers/core1.s2 2013-01-17 09:48:03 UTC (rev 23552)
@@ -638,6 +638,9 @@
function builtin get_entry_by_id(int id) : Entry
"Returns entry by the specified id";
+ function builtin get_entries_by_ids(int[] ids) : Entry{}
+ "Returns entries by the specified ids";
+
function builtin get_alien_post( string url ) : Entry
"Returns any public entry from any journal having give_posts_to_alien prop. Recipient must have get_alien_posts prop";
Modified: trunk/cgi-bin/LJ/S2.pm
===================================================================
--- trunk/cgi-bin/LJ/S2.pm 2013-01-17 08:54:41 UTC (rev 23551)
+++ trunk/cgi-bin/LJ/S2.pm 2013-01-17 09:48:03 UTC (rev 23552)
@@ -4826,6 +4826,23 @@
});
}
+sub Page__get_entries_by_ids {
+ my ( $ctx, $this, $ref_list_ids ) = @_;
+
+ my %ret;
+
+ if (ref $ref_list_ids eq 'ARRAY') {
+ for my $entry_id (@$ref_list_ids) {
+ if (my $entry = Page__get_entry_by_id($ctx, $this, $entry_id)) {
+ $ret{$entry_id} = $entry;
+ }
+ }
+ } else {
+ return undef;
+ }
+ return \%ret;
+}
+
sub Page__get_last_entries {
my ( $ctx, $this, $ljuser, $count ) = @_;
