Magento: how to configure cron settings using GUI? - php

It's not a problem to set cron intervals using xml-config file, but it'll be great to have ability to do that using config panel of custom module any time if needed. Friendly GUI instead of "terrible" XML, which could be accessible via FTP.
I have one idea only: catch some event when admin updates configuration of a given module and rewrite that xml-file by custom mechanism, but I don't like this solution. Maybe you know better or/and standard way?

Magento usually grabs all the cron data from the XML files you don't seem to be in favor of, but there's no reason you couldn't override it to use some other data model that gets retrieved from the database. Then you could have a simple interface to manage the cron details in the admin.

Related

Connecting Drupal Database with using External PHP script

I am currently developing php scripts, But At some point I wanted to connect to drupal database with my php scripts, I google about accessing drupal api with external php scripts, as many people suggested use bootstrap.inc file in your external php script, I like to ask here, lets say if I added this bootstrap.inc file and related code after that can i get access to use drupal api with its database?
I wanted to register a user with drupal database and also need to read some tables from drupal database, So can i achieved all this? including bootstrap.inc is enough or need to add any other module from drupal side, i external php script get access to drupal database?
Thanks.
If you still want to work outside Drupal, in a standalone script, you should include Drupal's include/bootstrap.inc and call drupal_bootstrap() function to initialize Drupal environment (connect to database, load modules, session, etc.). You can select the phase to bootstrap depending on what you need from Drupal.
define('DRUPAL_ROOT', 'YOUR DRUPAL ROOT');
require_once('includes/bootstrap.inc');
drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);
// Drupal is fully loaded here, you can access everything.
information source: https://drupal.stackexchange.com/a/24117
drupal information: http://api.drupal.org/api/drupal/includes!bootstrap.inc/function/drupal_bootstrap/7

How to go about allowing plugins for a custom framework?

First off, this isn't really a programming question but more of a programming concept question. Basically, I've built a bespoke PHP framework to speed up deployment on my end and I want some kind of plugin system in place that will allow me to add specific features to the base of the framework (like the SQL class or maybe a Twitter package) that will allow me to throw them into a folder and not have to actually edit the base for every new project.
Any ideas of the best way of going about this?
Here is a nicely written post by #ircmaxell on how to do that and what are the options:
Handling Plugins In PHP
Also check out:
Best way to allow plugins for a PHP application
what im doing in my cms:
for each plugin i make a folder latin-named of this plugin's name.
i create a /translations folder in there too. Check here.
have a single php file that has 2 basic functions, the plugin_install and plugin_uninstall (you know, things to happen on install/unistall like tables creation/drop)
create a special page of your system that reads these plugins, installed and not and give an on/off switch so users can install/unistall them.
load these single files mentioned above by a single call to include_once on top of your index page (or administration page) so to include whatever functionality they offer.
enabled plugins will be loaded (include_once) from your main page, and also their functionality, so each plugin can call each other's as well.

How to make a Joomla "build"?

In drupal, it's possible to create a "build", also known as "install profile" or "distribution" that basically combines several modules and your settings for them. So the next time you setup the same exact site, you don't have to re-configure all the modules.
Does Joomla have a similar concept, and what is it called? Please reference documentation as well if possible.
The concept is very simple - you just need to get a clean installation, install all the extensions you want and configure them the way you need.
Then it is enough to copy the files and the database to a new location and change the settings in the configuration file (configuration.php). That is all.
It is a very simple process and can easily be automated with a simple php script. I once did an asp.net app which was deploying new installations of joomla within seconds.
You could try something like http://www.akeebabackup.com/
This allows you to take a snapshot of a site and export it anywhere.

How can i Rollback for files/folders corresponding to the changes done?

I am using PHP and Mysql
I have PHP script in which I rollback all the data in the database such data all the old value be reset to the database if update is done, and all new value gets deleted if new insert has been done.
Now my goal is to perform the same process with files/folders associated with the changes done, I am not able to create an idea for doing the rollback job with the files/folders associated with the Changes.. So can anyone of u help me or direct me to get the best idea?????
EDITED
I want this functionality in one of my Joomla Component.. I have to it all through scripting
When it comes to managing histories and providing the functionality to "rollback" to a specific site-wide snapshot, you are probably well-advised to be looking into Source Code Management systems/techniques such as GIT, Subversion, etc.
These systems seem to be the industry standard for managing source code development, and should provide the functionality of which you speak.
If you are looking to create a self-contained Version Control system for these files and folders, then you will either need to custom create one, whereby any change to a file also records the contents of that file (and the change date/time) into a MySQL Table, or you may need to look at adapting an existing PHP/MySQL Version Control system as a component of your product (respecting, of course, their licensing terms).
I would recommend performing a Google Search for "php version control", and then looking through the results for an option which best suits your needs.
May be you should try to use the native api of the host operating system

Multi-site File Manager in PHP: Update a single file in multipe sites w/one click?

I have a hosting (hostgator) account with a master directory and multiple subdirectories, each representing a www address. I'd like to know if its possible to create an interface in php that would allow me to update a given file (say, header.php) in a specific folder (my custom wordpress theme which resides in each site) which will be the same in every site.
I currently have to do this via FTP, but its cumbersome b/c I have to open each directory and copy the file to it. So if I have 30 sites to update, its very time consuming. i'd like to just have a list of sites with a checkbox beside each of them (and a "select all" toggle) and run the update on all sites in one click)
Thanks for your input!
PS: I know there are probably chron scripts or interfaces that can do this, but I'll be creating a scriptable (PHP) solution I can package up and send to someone and it just works and is brain-dead simple to use.
Yes, it's possible, you can modify files using PHP's file functions and you can communicate what to update through sockets.
It would be fairly complicated to implement though so I'm not sure what you're asking for.. Yes it's possible but I doubt someone here will give you a copy&paste solution. Do you have a more specific question?
EDIT: an easier solution would be to have a SVN repository so you can simply do it with one line of PHP code:
`svn update`
Any reason you're not using WordPress MU? With it and the child theme functionality built into recent versions of WordPress, your life might be a lot easier.
Yes:
I currently have to do this via FTP,
but its cumbersome b/c I have to open
each directory and copy the file to
it. So if I have 30 sites to update,
its very time consuming. i'd like to
just have a list of sites with a
checkbox beside each of them (and a
"select all" toggle) and run the
update on all sites in one click)
Basically you need to script those FTP actions and provide some logic as to what path and what files. You can then style the entire thing with a simple front end, listing your sites with a checkbox to select.
Doesn't seem difficult, just have to get the FTP path traversal working and file cp'ing down.
Have a look at Phing and search Google for deployment with PHP
If you are hosting multiple WP sites, you really should use WPMU.
I've implemented Uploadify for single / multiple file upload. Works great.
I also use Wordpress.
if its just the header.php and you dont have svn (you could setup an hook which would copy it for you to the right place)
you could write a bash script if you have ssh access

Categories