Delete all traces of plugin in database - mysql

I deleted a WordPress plugin to install an older version of that plugin but the new version continues to show on the front end.
Steps I have taken:
I deleted the plugin folder.
Searched the database for any tables left behind by the plugin. No tables.
Searched the plugins scripts to see how it connects to database. I searched for the terms $wpdb, set_option() and update_option(). I only found update_option() in this plugins scripts.
I found the following in different locations in this plugins folder:
update_option( $option_key, $savedOptions );
update_option( $this->tabs[ $tab_id ][ 'option_key' ], array() );
update_option( $option_key, $option_data );
update_option( 'xoo_'.$this->slug.'_theme_templates_data', $tempData );
update_option( 'xoo-ml-before-2', 'yes' );
update_option( $version_option, XOO_WSC_VERSION);
And this is where I am stuck... Does any of the above code store info in the database that would prevent me from getting the old version of the plugin back?
My research has me looking in the direction of _options table but I am not sure what to do their or if that is where I need to be...

Related

How can I install Mediawiki extensions from the command line?

I'm trying to automate Wikimedia installation using Ansible and the Wikimedia command-line install script.
I noticed the current version includes script parameters for installing extensions. From the script help command:
$ php maintenance/install.php --help
CLI-based MediaWiki installation and configuration.
Default options are indicated in parentheses.
Usage: php install.php [--conf|--confpath|--dbgroupdefault|--dbname|--dbpass|--dbpassfile|--dbpath|--dbport|--dbprefix|-
-dbschema|--dbserver|--dbtype|--dbuser|--env-checks|--extensions|--globals|--help|--installdbpass|--installdbuser|--lang
|--memory-limit|--mwdebug|--pass|--passfile|--profiler|--quiet|--scriptpath|--server|--skins|--wiki|--with-extensions] [
name] <admin>
...
Script specific parameters:
--extensions: Comma-separated list of extensions to install
--with-extensions: Detect and include extensions
However, I am unable to find any other information on how best to use these parameters. Neither the Wikimedia manual pages on the install.php script or Extensions documents them:
https://www.mediawiki.org/wiki/Manual:Install.php
https://www.mediawiki.org/wiki/Manual:Extensions
Can someone point me to more details documentation on these parameters or provide an example of how to use them?
I am planning to do some trial and error and will answer this question myself if I figure out how they work before anyone else answers. But I know extension installation can get complicated and usually involves making config file updates so I hope I could find some existing documentation to guide me.
Short Answer
These extension parameters simply add a line to the LocalSettings.php file, if the named extension is found in the extensions directory, to load the extension at runtime.
Long Answer
I played with this a little. I tested the --with-extensions which, per the help docs, will detect and include extensions. What this appears to mean is that it will scan the extensions directory and install any extensions it find there.
I ran the following command:
php maintenance/install.php --with-extensions --dbserver="localhost" --dbname=foo --dbuser=foo --dbpass=foo --server="https://wiki.foo.localhost" --script path=/mediawiki -en --pass=foo "My Wiki Name" "Admin"
It produced the following block in my LocalSettings.php config file listing the default packages included with the current version of the Mediawiki core:
# Enabled extensions. Most of the extensions are enabled by adding
# wfLoadExtensions('ExtensionName');
# to LocalSettings.php. Check specific extension documentation for more details.
# The following extensions were automatically enabled:
wfLoadExtension( 'CategoryTree' );
wfLoadExtension( 'Cite' );
wfLoadExtension( 'CiteThisPage' );
wfLoadExtension( 'CodeEditor' );
wfLoadExtension( 'ConfirmEdit' );
wfLoadExtension( 'Gadgets' );
wfLoadExtension( 'ImageMap' );
wfLoadExtension( 'InputBox' );
wfLoadExtension( 'Interwiki' );
wfLoadExtension( 'LocalisationUpdate' );
wfLoadExtension( 'MultimediaViewer' );
wfLoadExtension( 'Nuke' );
wfLoadExtension( 'OATHAuth' );
wfLoadExtension( 'ParserFunctions' );
wfLoadExtension( 'PdfHandler' );
wfLoadExtension( 'Poem' );
wfLoadExtension( 'Renameuser' );
wfLoadExtension( 'ReplaceText' );
wfLoadExtension( 'SpamBlacklist' );
wfLoadExtension( 'SyntaxHighlight_GeSHi' );
wfLoadExtension( 'TitleBlacklist' );
wfLoadExtension( 'WikiEditor' );
The complexity of this parameter, probably wisely, goes no further than that.
I tried running this command to see if the --extensions=GoogleLogin parameter would auto-magically install the GoogleLogin extension. It did not. Rather it reported this error:
Could not find the registration file for the extension "GoogleLogin"
So if you're looking for a more full-featured Composer-like extension package-manager, this is not it.
When I downloaded the GoogleLogin extension and placed it in the extensions directory and ran the --with-extensions parameter and it did include it in the config file extensions block.
Without explicitly testing it, I concluded the --extensions parameters operates the same way as --with-extensions except that it will rewrite to the LocalSettings.php config file only those extensions explicitly specified and found in the extensions directory.

How to install DateTimePicker in Yii2

I have creating form fields. Here, i want to add DateTimePicker.
I have referred in google about some date time picker. i got so many.
DateTimePicker jQuery plugin
Bootstrap DateTimePicker.
My question is which plugin is best among them. and
How can i install that plugin?
Download directory and place where?
Install via cmd.?
You need to install or update your composer.
If you are using Ubuntu or Linux Operating System, open command prompt and run this command:
composer require --prefer-dist yiisoft/yii2-jui
This will create the jui folder which contains all the required plugins such as datepicker or any other you want to use in your website.
Now you just have to place this code in your form.php in views folder
use yii\jui\DatePicker;
<?= $form->field($model, 'from_date')->widget(\yii\jui\DatePicker::classname(), [
//'language' => 'ru',
'dateFormat' => 'MM-dd-yyyy',
]) ?>
You don't need to use jquery plugin for that. Yii2 has several widgets which you can use: Some of them are:
1) Yii2 Jui DatePicker
2) Kartik yii2-widget-datepicker
3) 2amigos yii2-date-picker-widget
You can use anyone of these.

Run initial RBAC migrations as part of a regular app migration

I am building a product that is based on the Yii2 advanced template.
As part of this product and its future deployments, I am trying to automatically create the tables related to Authorization in a regular Yii2 migration.
E.g, when the end user installs the product and runs the regular Yii migration commands he should have a fully functional user management AND authorization active.
For authorization to work, the Yii2 RBAC documentation page states that 4 tables are needed (auth_*). The documentation states that they are created by running the following migration:
yii migrate --migrationPath=#yii/rbac/migrations
I'd like to offset this extra hassle from the end user by running this specific migration code for him inside a regular migration that will be stored in common/migrations.
Any easy solution for this?
I have created a migrate.sh file where I put my migration commands that I need to run. This allows me to migrate from multiple places in the same time. It is quite simple, take a look here: https://github.com/Mihai-P/yii2-app-advanced/blob/master/migrate.sh
Instead of running ./yii migrate/up i just run sh migrate.sh that will update everything from any place.
The actual point of this is: you do not have to stick to exactly what Yii gave you. That is just a template for you to build on. Fork it, modify it, make it your own.
Try to add in console/config/main.php:
'controllerMap' => [
'migrate' => [
'class' => 'yii\console\controllers\MigrateController',
'migrationPath' => [
'#console/migrations',
'#yii/rbac/migrations',
]
]
],
Another approach (not using *.sh file) is to copy the rbac_init migration to your migrations folder:
cp vendor/yiisoft/yii2/rbac/migrations/m???????_rbac_init.php console/migrations/
Now, when you run php yii migrate it will be included the rbac_init migration.
I know this is pretty old question, but here is easy solution, create migration file and have this code in that file
<?php
require(Yii::getAlias('#yii/rbac/migrations/m140506_102106_rbac_init.php'));
/**
* Class m220225_133725_init_rbac
*/
class m220225_133725_init_rbac extends m140506_102106_rbac_init
{
}

Make files available for download

I am working on a page where one can view the contents of one (or more) text-files. I would also like a download button which allows for a download of those files. I would like to stick these files in an archive before downloading.
What I would like to avoid is having a copy of both the files & the archive on my server (update one but not the other .. etc).
How should I go about this?
Should I keep both the files & the archive anyway
Do I create the archive on the fly (i.e. when the user hits the download button)
Do I extract the contents of the archive each time the page is loaded
Are there any libraries that you know of that already do this sort of thing (I have searched but didn't come up with anything useful)
A backend strategy that somehow prevents a discrepancy between files & archive
....
Thanks
You could use PHP as backend(Some server side language is needed to create zips on the fly) and create zips based on user requests.
$files_to_zip = array(
'preload-images/1.jpg',
'preload-images/2.jpg',
'preload-images/5.jpg',
'kwicks/ringo.gif',
'rod.jpg',
'reddit.gif'
);
//if true, good; if false, zip creation failed
$result = create_zip($files_to_zip,'my-archive.zip');
Further information http://davidwalsh.name/create-zip-php

How can I use pdfk fill_form without writing to a temp file

I am trying to populate a pdf report with data from my mysql database. It works fine on my local machine but when I upload it to www.000webhost.com, the pdf document is not generated.
I know the document writes a temp file to my folder every time I click print report.Can anyone tell me why it doesn't work on the hosting provider and how I can fix this issue. I am under the impression that it is a security issue.
Do I have to write a temp file. Why couldn't I have used the $fdf variable to populate the report instead of the temporary file?
$fdf_fn= tempnam( '.', 'fdf' );
$fp= fopen( $fdf_fn, 'w' );
if( $fp ) {
fwrite( $fp, $fdf );
fclose( $fp );
//attachment for view
header( 'Content-type: application/pdf' );
header( 'Content-disposition: inline; filename=TEST.pdf');
passthru( "pdftk ./../../reports/TEST.pdf fill_form ". $fdf_fn.' output - flatten' );
unlink( $fdf_fn ); // delete temp file
Can anyone tell me why it doesn't work on the hosting provider and how
I can fix this issue. I am under the impression that it is a security
issue.
My guess is you simply don't have write permission in the required directory.
You create your temporary file in the current working directory (.). Depending on your hosting provider and the HTTP server configuration, the current working directory is not necessary what you think nor writable. Especially since your program will probably run with the www or nobody identity.
I assume you have to create and then adjust the permissions on your "temporary" directory -- or use a "world writable" location such as /tmp.
Finally, you have a relative path that move "upward" in your program: ./../../reports/TEST.pdf fill_form There is little chances for this to be valid on your hosting...