[wp-hackers] Custom themes/plugins server
Christopher Ross
cross at thisismyurl.com
Mon Aug 9 14:38:23 UTC 2010
Lox,
I do something fairly basic in my custom plugins using the code below I download a copy of the plugin every week and overwrite the existing custom plugin, that way I am sure that any changes I make are published to client websites every seven days, since I do a lot of work with charities and manage the sites ongoing this process saves me a ton of labour.
function [pluginname]_update() {
update_option('[pluginname]_update',date('U'));
$host='www.thisismyurl.com';
$ua='Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.0.6) Gecko/20060728 Firefox/1.5';
$fp = fsockopen($host, 80, $errno, $errstr, 30);
if ($fp) {
$out = "GET /plugin-updates/[pluginname].zip HTTP/1.1\r\n";
$out .= "User-Agent: $ua\r\n";
$out .= "Host: $host\r\n";
$out .= "Connection: Close\r\n\r\n";
fwrite($fp, $out);
while (!feof($fp)) {$data .= fgets($fp, 128);}
fclose($fp);
}
}
If this code was in a function, you could call it from the footer
if ((get_option('[pluginname]_update')+(600000)) < date('U')) {[pluginname]_update();}
Now, each time the page loads it does a quick check to see if it's been updated in the past 600,000 seconds or if it needs to do an update today.
Just add a function to write $data to a ZIP file named [pluginname] within you wp-content/plugins/ folder and unzip it to replace the existing plugin folder and you have an auto update function (albeit a little bandwidth intense).
Chris
On 2010-08-09, at 11:20 AM, Louy wrote:
> Hello,
>
> I actually want that too! Anyone?
>
> Thanks.
>
> On Mon, Aug 9, 2010 at 2:34 AM, Lox <lox.dev at knc.nc> wrote:
>
>> Hello,
>>
>> Here is the case: I make website for my customers using wordpres.
>> Thus, I make for them some very specific themes and plugins. Those
>> can't be made public, but I want my customers to be able to have
>> update notifications and to update their plugins/themes with one click
>> (like it is done for public plugins/themes)
>>
>> Can you guide me on how to achieve it?
>>
>> Regards.
>>
>> --
>> Lox
>> lox.dev at knc.nc
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>
>
>
>
> --
> Louy
> http://louyblog.wordpress.com/
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
__
Christopher Ross
Toronto 1 (416) 840-5828
Fredericton 1 (506) 474-2708
New Orleans 1 (504) 322 3485
http://christopherross.ca
http://www.thisismyurl.com
More information about the wp-hackers
mailing list