Embedding Recent Changes on Main Page on MediaWiki - mediawiki

I am a complete and total newbie with MediaWiki. I would like to find a way to include Recent Changes directly on the Main Page, without having to have the user navigate to the recent changes page. What are my options for this?
Thanks!

One way would be to put
{{Special:RecentChanges}}
in [[Main_Page]].

The News extension (available at http://www.mediawiki.org/wiki/Extension:News ) is a way to do this very simply, and can be customized so that the entire recent changes page is not displayed. Just install the extension and then adding the
<news/>
tag will include the 10 most recent changes. Parameters to change the number of items shown, exclude minor changes, or format how they are displayed are available on the website linked above.

There is also an extension : Dynamic Article List - which allows you more control over what to display in your list of recent changes.
http://meta.wikimedia.org/wiki/User:Socoljam/DynamicArticleList_%28enhanced%29
This is an enhanced version of a MediaWiki extension of the same name. It also provides slightly clearer instructions to install it and get it working.

I wanted the same thing, but in a much simpler list than the full output of {{Special:RecentChanges}}. The following database query gives just the page names of the changes in the last 30 days, without the recently deleted pages:
SELECT DISTINCT rc_title
FROM recentchanges
WHERE rc_timestamp > (CURRENT_DATE - INTERVAL '30 days')
AND rc_new_len > 0
ORDER BY rc_title
(This is with PostgreSQL. It might be slightly different with MySQL)
To put that on the Main page, I used the ExternalData extension with it's #get_db_data function.
In LocalSettings.php:
wfLoadExtension( 'ExternalData' );
$wgExternalDataSources['mydb'] = [
'server' => '127.0.0.1', // or 'yourwiki.example.com',
'type' => 'postgres', // mysql, postgres, sqlite, ...
'name' => 'wikidb', // wiki DB name
'user' => 'backup_bot', // user with only "SELECT" rights
'password' => ''
];
Then, in the Main_page:
{{#get_db_data:
db=mydb
|from=recentchanges
|where=rc_timestamp > (CURRENT_DATE - INTERVAL '30 days') AND rc_new_len > 0
|order by=rc_title
|group by=rc_title
|data= title=rc_title
|suppress error
}}
Changes in the last 30 days:
{| class="wikitable"
! title
{{#for_external_table:<nowiki/>
{{!}}-
{{!}} {{{title}}}
}}
|}
Or as a simple list:
{{#for_external_table:
* [[{{{title}}}]]
}}

Related

Excluding Custom Taxonomy Terms from a CPT Archive Page

After referring to all the other posts about similar subjects, and attempting to Frankenstein together a solution, I've decided to do the thing I never do and ask for help. :)
I need to have specific posts tagged with specific terms from a custom taxonomy excluded on a Custom Post Type Archive page only (so they still show up in their own individual archive pages)
The CPT: 'Guest' - default slug is 'guest' -but the archive slug is set to 'guests' (I've tried using both)
The Taxonomy: Guest Type - slug is also set to 'guests'*
**Code I've come up with so far: **
// Guest Archive Category Exclusions --->
function exclude_posts( $query ) {
if ( $query->is_archive('guest') ) {
$query->set( 'guests', array( -180, -205, -179 ) ); //Exclude inMemorium, Postponed, Alumni
}
}
add_action( 'pre_get_posts', 'exclude_posts' );
//END Guest Archives Category Exclusions <--
Thank You so much for your help!
*totally off-topic explanation for the curious - the slugs were both set to 'guests' on purpose since there is no archive page set for a taxonomy type. Bonus points if you know how to activate one.
I've tried multiple things from the other threads on similar topics.
They either break the site or do nothing.

Drupal 8 - multisite with shared tables (user tables / all tables)?

I need to create about 20-30 Drupal8 sites on different domains. There will be similar content (difference only in details like city name, ajax calls, etc.) but also there will be a specific content like news.
I know all weakness of this idea, but anyway I think that shared tables in one database will be the best solution for this project.
My steps:
installing first default site (sites/default) with prefix for tables default_
creating directory for second site (sites/second), and configuring sites.php (seconddomain.com => sites/second)
installing second site (sites/second) with prefix for tables second_
... then I tried to use solution which is described on many sites:
$databases['default']['default'] = array(
'database-configuration-stuff' => '[...database configuration]'
'prefix' => array(
'default' => 'second_', // default prefix for second site
'users' => 'default_', // shared users...
'sessions' => 'default_',
'role' => 'default_',
'authmap' => 'default_',
),
);
but it doesn't work. I see only users from second site. Cache cleaning doesn't change anything. Any ideas?
Maybe there is possibility to create multi-page solution with one shared database (not only for users but for nodes also) and create content directed to different domains from one admin console?
BTW: If there is any possibility to create sth like this using Drupal7 I can change d8 to d7.
if you'd like to make sth I was looking for you've got three options:
you need to write your own module ;) ,
you need to wait for "Domain Access" module for D8: https://www.drupal.org/project/domain ,
you can also use D7 and module from URL which I provide above.
I chose 3rd option.

CakePHP not finding all fields in table, even after model cache deleted

So my app is running in development mode in one place and in production mode on its live server. I've just put some changes live and a field that has been in the production DB (MySQL) for a good week or two is not being found by a call to Model::read(). Here's the code, verbatim:
$this->Order->id = $id;
$created = $this->Order->field('created');
$this->Order->contain(array('User', 'OrderStatusChange', 'Cart' => array('CartItem' => array('conditions' => array('deleted_date' => null, 'created <=' => $created)))));
$this->request->data = $order = $this->Order->read();
Same code in dev environment returns all fields. The new(ish) field is missing in production. I have deleted every file in /app/tmp/cache/models and it has not fixed the problem. The production site has Configure::write('debug', 0), development site is set to 2.
Any ideas?
Thanks
As you already cleared your caches, but problem still exists. So, I will point out one things here:
$this->Order->contain(...) here you're using contain() and for contain(), need to attach Containable behavior to model. Your code doesn't clarify that you attach that or not. If not, then I will suggest you to attach that like:
.....
$this->Order->Behaviors->attach('Containable'); // attach Containable behavior
$this->Order->contain(...);
......

Wordpress - How do I output the last query used by query_posts?

I am attempting to grab all posts for a specific day (ie: today), however for some reason it is only returning the one.
$wp_posts = query_posts(array(
'cat' => 4,
'post_status' => array('any', 'publish', 'future', 'inherit', 'revision', 'pending'),
'year' => '2011',
'monthnum' => '10',
'day' => '25',
'order_by' => 'post_date',
'order' => 'ASC'
));
This should post all the posts for today under a category, but whatever reason it only outputs 1 post and I do not know why.
At first I thought it might be a permalink issue, but I removed the permalinks and its still only returning the one post?
On my localhost the code works fine and outputs all the content required for a specific day.
Additionally, I have checked the database and all the posts for the day are there and appear to be in schedule or posted status.
So there is no reason why the query_posts should be returning just 1 item.
I want to output the last query used by query_posts to investigate what is causing the problem.
How do I verbosely output the last query as used by query_posts?
Thanks.
Edit.
I will accept an answer that converts the above to a verbose SQL query which I can run to see what is going on
Take a look at http://codex.wordpress.org/Editing_wp-config.php#Save_queries_for_analysis (please make sure you take note of the warning to not do this on a production site).
The solution is that you probably need to set the posts_per_page value in your arguments array to -1.
I figured out what the problem was.
On http://codex.wordpress.org/Custom_Queries it seems to imply that a post_limit has a default.
I successfully outputted the entire object using a blank page and combining WP_Query with my posts array posted above.
In it I found a response with a limit of 0,1
I'm not sure why it put this in, or why it only affected my live site.
But this seems to correspond with the limit I noted in the Custom_Queries code.
In my file, I put this:
add_filter('post_limits', 'gloss_limits' );
function gloss_limits( )
{
return "";
}
As per the Custom_Queries URL.
And it removed the limit and I finally got to output everything from that day.
I've accepted Jorbin's answer as the 'Save queries for analysis' is a specific answer to my query.
the last query is always stored in $wpdb->last_query
and for post queries as well in $wp_query->request

Redmine's "latest projects" criteria

When there are more than 5 projects registered on Redmine, those listed on main page's "Latest projects" box are sorted by creation date descending (more recently created first), leaving old projects (which could have been more often updated) out of the list.
Is there a way to list top 5 projects by activity from highest to lowest, or display all registered projects, in that very box, without changing code ? (I don't have access to it).
My version is Redmine 1.0.1.devel (MySQL).
Thank you.
You can change the code in app/models/project.rb to say something different where it says 'count=5' change it to something like 'count=20':
# returns latest created projects
# non public projects will be returned only if user is a member of those
def self.latest(user=nil, count=5)
find(:all, :limit => count, :conditions => visible_by(user), :order => "created_on DESC")
end
If you don't have access to the code then you'll have to just keep using the drop down menu instead.
Browsing around the redmine source for 1.0, it looks like there's no setting for sort order:
http://redmine.rubyforge.org/svn/branches/1.0-stable/app/controllers/welcome_controller.rb