MediaWiki : storing in external databases - mediawiki

I am finding out a way to store the data in external databases rather than the default mediawiki database. As far as reading part is concerned, I am using the ExternalData extension as follows.
{{#get_db_data:
db=journal-db
|from=journals
|where= JQ2 > 9
|data=rank=Rank,name=Name,rating=Rating,jq2=JQ2
}}
This works perfectly fine. I get the results from the external database in variables data, name, rating, jq2. Now can anyone help me with how to store the data in external database, since there is not much documentation available for it? Thanks in advance !!

You might want to check the new https://www.mediawiki.org/wiki/Extension:Cargo

Related

How to add manage temparory data in DotnetNuke?

I am beginner in DNN. I am creating a module which provides Login, Dashboard and Add-Update Form. I have data in JSON format. I want to store it temparory while user use the website. Data will be destroy as soon as user will close the website.
Currently I have created a folder in my Solution Explorer of project in Visual Basic and created 3 .json files which stores login_info.json, basic_info.json and auth_info.json. I write json data whenever user login and I make it blank when user logout.
Above method is working fine now but I afraid it will work when I will publish this module.
Also I may have situation where I need to store image some where. I don't know how I will manage.
Can anybody please guide me?
Is this proper way to store data temparory in DNN?
Is there any other better way?
After getting one of reply for Database Suggestion
Is there any table which same as User Meta in DotnetNuke?
You use the ConnectionString that is used by DNN and access the database as you would normally.
DotNetNuke.Common.Utilities.Config.GetConnectionString()
Or you can use the Data Access Layer that the DNN Framework supplies. For that take the Christoc Templates. In there is all you need to communicate with the DB.

Mediawiki custom namespaces id change

I am currently working on an internal Mediawiki and we are using a lot of custom written extensions.
Because we did no know better, defined custom namespaces for our own extensions and articles with an id that is smaller than 3000.
For example:
define('NS_bla', 1100);
$wgExtraNamespaces[NS_bla] = "bla";
define('NS_bla_TALK', 1101);
$wgExtraNamespaces[NS_bla_TALK] = "bla Talk";
We did this with several different extensions. Now we read on the official documentation (http://www.mediawiki.org/wiki/Extension_default_namespaces) that custom namespaces should use id's that are 3000+.
Therefore my question: How can we easily change the IDs of the namespaces on the production instance, without messing up with our current dataset? How could we tackle this problem? I could not find any information on the Mediawiki documentation.
Thank's a lot in advance and
Cheers from Germany,
Fabian
To answer the question, you would need to update the page table with the new namespace ID:
http://www.mediawiki.org/wiki/Manual:Using_custom_namespaces#Use_a_database_query
To fit this to your occassion, it would be:
UPDATE page
SET page_namespace = 3000
WHERE page_namespace = 1100
You shouldn't have to replace the page_title since these articles are already in another namespace.
Just please remember to back up your database before trying this.

Drupal node / data import issue

I have a client who needs to have data imported into drupal from a large spreadsheet. They already had the modules setup and I have the data all in the right tables... so it seems. I have run my own custom scripts to manipulate what was in the spreadsheets and exported / imported it into the drupal databases.
However, when I go to view that type of content in the backend, it shows there are multiple pages of data but displays "No content available." in every page. Here are the tables I imported to:
// for the business listing node type
field_data_field_bd_address_city
field_data_field_bd_address_street
field_data_field_bd_address_zip
field_data_field_bd_business_type
field_data_field_bd_contact_email
field_data_field_bd_contact_name
field_data_field_bd_description
field_data_field_bd_image
field_data_field_bd_listing_type
field_data_field_bd_phone
field_data_field_bd_tags
field_data_field_bd_website
// drupal default tables
node
node_comment_statistics
taxonomy_index
taxonomy_term_data
taxonomy_term_hierarchy
taxonomy_vocabulary
Am I missing any tables that I need to import data into to make connections?
I had this problem before and it took me a while to solve it. This was before anyone had mentioned the feeds module to me so I thought it was my only option.
If you're going to upload straight into your database you need to enter the data into the revisions tables as well. So you would have:
// for the business listing node type
field_data_field_bd_address_city
field_data_field_bd_address_street
field_data_field_bd_address_zip
field_data_field_bd_business_type
field_data_field_bd_contact_email
field_data_field_bd_contact_name
field_data_field_bd_description
field_data_field_bd_image
field_data_field_bd_listing_type
field_data_field_bd_phone
field_data_field_bd_tags
field_data_field_bd_website
And also:
// for the business listing node type
field_revision_field_bd_address_city
field_revision_field_bd_address_street
field_revision_field_bd_address_zip
field_revision_field_bd_business_type
field_revision_field_bd_contact_email
field_revision_field_bd_contact_name
field_revision_field_bd_description
field_revision_field_bd_image
field_revision_field_bd_listing_type
field_revision_field_bd_phone
field_revision_field_bd_tags
field_revision_field_bd_website
The same goes for the node table. This took me a while to work out and worked for me. Typically someone then mentioned the feeds module which would have saved me time but I thought I'd share what worked for me.
Instead of manually importing the data directly into the database and trying to figure out how to satisfy all the relational dependencies to make it work, I would suggest using the Feeds module
If you wish to continue with the manual process, perhaps this ER diagram of the Drupal database will help (keep in mind it is a bit dated and was likely based on earlier versions of Drupal 7).
I figured it out. I had to add data to the node_revision table with status of 1 set to all the nodes and it worked out just fine after that!

fluent nhibernate + how to create sql schema

I have a question about how to render the sql schema with fluent nhibernate.
I have searched alot and used a couple of things but i dont know how to render it. I´m only building the ground of my website, the core. And now i want to create the database from my mappings. How do i do that? Is it with testrunning or what?
If i build the solution i don´t get any sql file i have also tried export it to hbm files to use schema tool export but dont get it to work.
have tried
Fluent NHibernate (1.2.0.712) export mappings to HBM not working / not respecting conventions
and
https://stackoverflow.com/questions/5244257/build-schema-with-fluent-nhibernate
and alot other links.
What do i have to do to get the sql file? every site give almost the same code but they don´t tell how to render it. How to execute the process to retrieve the file..
can anyone tell me? i can build it by my self but i want to try this function!
best regards
You can create the database using the SchemaExport.Create method:
// this NHibernate tool takes a configuration (with mapping info)
// and exports a database schema from it
new SchemaExport(config)
.Create(true, true);
If you want to see the generated SQL, you can use the ShowSql method, but this is not required to create the database.
_sessionFactory = Fluently.Configure()
.Database(SQLiteConfiguration.Standard
.UsingFile(SqliteDatabaseFullPath())
// Display generated SQL in Output window
.ShowSql()
)
...
It's been my experience with NHibernate that it's almost always best to start with a working example, so I suggest you get the FirstAutomappedProject sample project that is part of the FNH source. This will give you all the pieces you need.
Probably easiest to download the zip file (button on the upper left) which includes all the FNH source code, and look in the "src" folder for the examples.

Can't access MySQL views when moving the PHP application on another server

My current project is about doing some changes in an already build web application (PHP/MySQL). For displaying data, the previous developer used views. I got the app on my computer in order to get familiar with it and I can't seem to make those views work (I don't get any output in the app).
I searched the web for this an there seems to be a problem when you create a view with one database user and the that user no longer exists.
Anyone who got into this issue before? How can this be solved?
If you're importing the views from SQL dump file, they are probably defined like this
CREATE DEFINER = 'userWhoDoesNotExist#thisServer' VIEW viewName AS ....
Try removing the DEFINER = part, and the view will be created using currenct user account.
since you are running the server on your own computer, I am assuming you have root access. Try using something like
ALTER VIEW brokenView DEFINER='newuser'
this passes the validation check here. As long as you are root when you do this, you should be able to recover your views.