Mediawiki blank all pages per namespace. I want to blank all User_talk pages - mediawiki

I want to know if there is a way to blank all user_talk pages enmass. Not delete them, just blank them. I don't know how to write bots, so I'm really asking if there is an extension or pre written bot for this. Thank you

You could write a simple SQL to do this, just look into the page table, for my installation the namespace value for User talk: is 3, so I could just delete all pages with namespace=3.
Deleting the row from the database, will leave the page as blank (not created)

I suggest using AWB. You can easy have it build a list based on a names space and then use a simple ReGeX replace such as: Search: (.*)* Replace with: (empty space).

Related

Upload Text File Containing Long List of Tags to WordPress

I have a text file with about 6700 tags that I would like to add to my Word Press site. Of course, it is not efficient to do this manually. Is it possible to automate the insertion of these tags?
I tried a few plugins like Smart Tag Insert, but these are ineffective and have low review scores. Additionally, I see that tags in my MyPHPAdmin panel are stored in the table wp_terms. I wanted to write an SQL script that does what I need. However, the table also stores a series of other values (like menu names). There is no way to identify rows in this table as tags and not something else (like the name of a menu). So, I am also confused about that too.
Thank you for your time and help!
You should loop through all the tags in the file and then use the wp_insert_term function to insert the tags into the database.
Documentation : https://developer.wordpress.org/reference/functions/wp_insert_term/
So the first argument is the tag term and the second one is post_tag.
Exemple:
wp_insert_term(
'tag_name', // the term
'post_tag', // the taxonomy
);

MediaWiki - User Table

I'd like to include a table with all registered users on a page in my MediaWiki but the only user list I can find is the special page "Active users list".
Is it possible to include this (or a similar list with e.g. the entered real name) on a wiki page?
Thanks in advance for your help.
You can use the Special:ListUsers special page for this. It's a list of all users registered in your wiki.
You can include some special pages just like templates. So, to include the Special:ListUsers page on any wiki, you just need to paste the following wikitext code into the page where you want to show the user list:
{{Special:ListUsers}}
The limit for the list is 50 (iirc), so if you want to increase the length of the list, you can pass the limit parameter to the inclusion syntax:
{{Special:ListUsers|limit=100}}
However, I don't think that Special:ListUsers provides a way to show the real names of users, sorry.

Regex To Exclude Email-Expression

I have 430 HTML files of different organization's contact us web pages, I was given this files to extract emails from.
This regex simple code I came up with detects and finds emails throughout the files
\S*#\S*
My Problem
I'm trying to select everything besides the emails so I can use Notepad++'s "Replace All in All Opened Documents" function to delete everything besides the emails. Is this possible with regular expressions?
Is there anyway I can select everything outside of the regular expression provided above?
Make sure you have a recent version of Notepad++ installed to have the necessary regex support:
Find what : (^|\s+)[^#]+(\s+|$)
Replace with : \n
🔘 Regular expression
The . matches newline option does not influence the action.
You need to remove all text that does not match some pattern.
You need to match and capture the emails with a (...) capture group and then you need to just match everything else.
Use a pattern like this: ( + your_pattern + )|., and replace with $1.
Or, use:
([^\s<>"]+#[^\s<>"]+)|.
or
(\b[A-Za-z0-9._%+-]+#[A-Za-z0-9.-]+\.[A-Za-z]{2,4}\b)|.
Replace with: $1
Then, you might want to use Edit -> Blank Operations -> Remove Unnecessary Blank and EOL menu option.

Return certain part of string mysql

I am fetching results from a database table which contains the text of multiple pages.
These pages have links in their content.
I am trying to get all the links from the pages in a table, but I am also getting the unwanted text.
For example, this could be the content of a certain part of a page:
line 1: This is the link for lalalaal </a href="page5.html"> click</a>
line 2 if you want to go to page lalalala2 click
Now I only want the area starting from the <a href and ending at </a> in the result record. if there are more than 1 anchor tags in the text, then each anchor tag should be treated as a record.
the returned result should be like
ID value
1 ' click '
2 ' click '
I have tried the following queries :
Select * from [Database.tablename] where value between <a href and </a>;
Select * from [Database.tablename] locate '(<a href, Value)>0' and locate (</a>, value)>0;
but none of the 2 queries are giving me the wanted result...
This sort of text extraction is probably best addressed using regular expressions.
MySQL has some support (see here), but it could only be useful to identify which rows do have an <a></a> pair. Even identifying that there is at least one link inside a record doesn't help you extracting the (possibly many) links and treating them as different records themselves.
To successfully extract those links, at least according to my knowledge, you need a tool better suited to work with regular expressions. Most languages (Perl, PHP, Python, Java, etc.) support them, some natively, some using available libraries. You can select only records containing links (using REGEXP), and extract every link via code.
Another way of handling this would be performing the query on MySQL, exporting the results to a text file, and working on its contents with shell scripting (for instance, using sed under UNIX/Linux).
If you need it to be implemented using only MySQL, then my best guess is trying with a stored procedure (to be able to work on the results record-by-record.) I still cannot think of an implementation of such SP that guarantees detecting and successfully extracting every possible link inside a record as one record per link.

Edit mySQL record inside HTML Table via double click - Is it possible?

I have an HTML TABLE that displays my records from mySQL.
I need to edit various records (rows). Is it possible to click on a table row and edit the values in the row inside the HTML table?
I was wondering if there are any PHP scripts out there to guide me?
Yes, it's possible. While I am very convinced PHP is involved, Javascript is involved also.
I think you can have something like this:
1.Click once, javascript increases a counter variable
2. Click twice, javascript checks if var = 2 after increasing, resets counter, and changes innerHTML of the td to something like this:
form action ='yourphpscript.php' method = 'getorpost'>
.....What you want to change....
</form>
3. So then it sends your values to the PHP script, PHP script changes values in database, and you get redirected back to the main page. Or, better yet, use AJAX.
Hope this helped :)