php-general Digest 12 Jun 2005 01:14:05 -0000 Issue 3507

Topics (messages 216846 through 216853):

Howto implement atomical actions
        216846 by: Andy Pieters
        216848 by: Chris Shiflett
        216851 by: Manuel Lemos
        216853 by: Richard Lynch

Re: Getting help on using the PHP lists
        216847 by: Paul Waring

Re: using require
        216849 by: Christian Heinrich

news php 5.0.5/5.1
        216850 by: mbneto

Re: fwrite/fopen
        216852 by: Mister Jack

Administrivia:

To subscribe to the digest, e-mail:
        [EMAIL PROTECTED]

To unsubscribe from the digest, e-mail:
        [EMAIL PROTECTED]

To post to the list, e-mail:
        [email protected]


----------------------------------------------------------------------
--- Begin Message ---
Hi all

I am developing a web interface to patch a program.  The user uploads the 
patch and after uncompressing and verification of signature, the update 
should take place.  However I do not want users to be able to start an update 
and then abort the process by stopping to load the page.  

I imagine that by calling a program externally from php that it would be 
possible but there are limitations because of the distribution.   The systems 
are installed on php+mysql+apache servers but no shell access is granted.

I greatly appreciate help in this matter.


With kind regards


Andy

-- 
Registered Linux User Number 379093
-- --BEGIN GEEK CODE BLOCK-----
Version: 3.1
GAT/O/>E$ d-(---)>+ s:(+)>: a--(-)>? C++++$(+++) UL++++>++++$ P-(+)>++
L+++>++++$ E---(-)@ W+++>+++$ !N@ o? !K? W--(---) !O !M- V-- PS++(+++)
PE--(-) Y+ PGP++(+++) t+(++) 5-- X++ R*(+)@ !tv b-() DI(+) D+(+++) G(+)
e>++++$@ h++(*) r-->++ y--()>++++
-- ---END GEEK CODE BLOCK------
--
Check out these few php utilities that I released
 under the GPL2 and that are meant for use with a 
 php cli binary:
 
 http://www.vlaamse-kern.com/sas/
--

--

Attachment: pgpTHPePJkEcr.pgp
Description: PGP signature


--- End Message ---
--- Begin Message ---
Andy Pieters wrote:
I am developing a web interface to patch a program. The user uploads
the patch and after uncompressing and verification of signature, the
update should take place. However I do not want users to be able to
start an update and then abort the process by stopping to load the
page.

You can ignore user aborts:

http://php.net/ignore_user_abort

This has very little to do with atomic actions, but maybe it answers your question. :-)

Chris

--
Chris Shiflett
Brain Bulb, The PHP Consultancy
http://brainbulb.com/

--- End Message ---
--- Begin Message ---
Hello,

on 06/11/2005 10:46 AM Andy Pieters said the following:
I am developing a web interface to patch a program. The user uploads the patch and after uncompressing and verification of signature, the update should take place. However I do not want users to be able to start an update and then abort the process by stopping to load the page.

You can try using flock in exclusive mode on a lock file of a fixed file name.

--

Regards,
Manuel Lemos

PHP Classes - Free ready to use OOP components written in PHP
http://www.phpclasses.org/

PHP Reviews - Reviews of PHP books and other products
http://www.phpclasses.org/reviews/

Metastorage - Data object relational mapping layer generator
http://www.meta-language.net/metastorage.html

--- End Message ---
--- Begin Message ---
On Sat, June 11, 2005 6:46 am, Andy Pieters said:
> I am developing a web interface to patch a program.  The user uploads the
> patch and after uncompressing and verification of signature, the update
> should take place.  However I do not want users to be able to start an
> update
> and then abort the process by stopping to load the page.
>
> I imagine that by calling a program externally from php that it would be
> possible but there are limitations because of the distribution.   The
> systems
> are installed on php+mysql+apache servers but no shell access is granted.

Perhaps it would be best to take PHP out of the picture entirely after the
upload.

For example, upload to a temporary directory, and, as your last PHP step,
use http://php.net/rename to move the uploaded file to a "to_be_installed"
directory.

Then you can have cron job 2 minutes that installs anything it finds in
that directory.

At that point, nothing the user can do can interfere.

That wouldn't necessarily make the operation atomic...

What makes a "patch" atomic?...

You'd be looking at something like subversion for that, I should think...

I don't think even tar -xzf guarantees atomicity, but I dunno.

-- 
Like Music?
http://l-i-e.com/artists.htm

--- End Message ---
--- Begin Message ---
On 6/10/05, Leila Lappin <[EMAIL PROTECTED]> wrote:
> Have you tried changing the subscription options through the website?  I
> think you can do it by just checking the type of list you're interested in
> subscribing.

I don't know about other people, but I've had lots of problems trying
to subscribe through the web site - I never got the confirmation
emails and in the end I just subscribed via email using
php-general-subscribe.

-- 
Rogue Tory
http://www.roguetory.org.uk

--- End Message ---
--- Begin Message ---
Hi,

this depends on which connection-function you've used. If you've decided to use pg_pconnect(), there is just one connection. If you use pg_connect, everytime a new connection is established (and after finishing the script, it's closed though)

HTH
Christian

hi all,


i have my web site working something like this: in every php script i have require(auth.php). this auth.php has my connection to my postgresql server and database along with some other stuff i need for the user to be authenticated to my web site. when i log on, this auth.php connects to the dbserver and checks if my username and password are stored and then i go to a home page. my connection is stored in $dbh. what happens when i start moving through all these web pages (php scripts), each requires auth.php, with respect to the connection? is a new connection established for every web page i go into that uses my $dbh for querying purposes or is it the same connection i originally made when i first logged into the web site?


any info will be highly appreciated!!


thanx.

--- End Message ---
--- Begin Message ---
Hi,

I've looked at php.net but could not find info regarding if/when are
we going to have further 5.0.x versions and what will change in php
5.1.

Any pointers (besides the php-devel) ?

--- End Message ---
--- Begin Message ---
fwrite failed for "quota disc exceeded", so I end up with empty file.

the algorithm is something like : 

    if (! $fp = @fopen($config['pagecachedir'].$path.$tmp_value,'wb')) {
                 $errorLog .= "Writing problem for ".$config['pagecachedir'].
                "$path$tmp_value!\n";
   } else {
      $txt_length = strlen($txt);
      if (@fwrite($fp,$txt,$txt_length) != $txt_length) {
      $errorLog .= "Writing problem in file !\n";
      @fclose($fp);
      @unlink($config['pagecachedir'].$path.$tmp_value);
  } else {
      //everything is OK
       @fclose($fp);
   }


On 6/11/05, Richard Lynch <[EMAIL PROTECTED]> wrote:
> 
> You would probably have to fclose it before you can unlink it, and if it's
> fargled enough that fwrite failed, you probably can't fclose it
> successfully...
> 
> Your best bet would be to put the filename into a database table, then run
> a cron job that deletes all the files in that table, and only takes them
> out of the table if they are successfully deleted.
> 
> Course, you then want to be sure you have UNIQUE filenames so you don't
> delete a good file later.
> 
> 
> 
> On Fri, June 10, 2005 4:03 pm, Mister Jack said:
> > Hi,
> >
> > I having a problem at the moment, I open a file, try to write in it,
> > and then remove the file if the write goes wrong (if write count != of
> > my initial buffer length). But I still get some empty file (and then a
> > blank page). Could possibly fopen (with a 'wb' flag, and under freebsd
> > 4.11) failed but still create that empty file ?
> >
> > Where could I get more info on the behavior of fopen/fwrite ?
> >
> > Thanks for your help.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
> 
> 
> --
> Like Music?
> http://l-i-e.com/artists.htm
> 
>

--- End Message ---

Reply via email to