logs archiveIRC Archive / Freenode / #php / 2015 / August / 17 / 1
runinsquares
an abstract class has complete functions
or rather CAN HAVE
it can also have abstract functions
azswa
Bruce_Dev> depends on your requirements, abstract class allows you to have common methods
Bruce_Dev
ah ok
azswa
azswa> I means, fully defined methods
runinsquares
abstract methods are more like interface
if the objects are related in some way extending makes sense
that's up to your requirements
if they're not related you could use interface/trait
you can typehint the interface
Bruce_Dev
well I can only extend one class though right?
runinsquares
you can't extend from more than one class
Bruce_Dev
yea
i get what you mean now
Utils
Are file uploads handled by PHP or by apache? I'm just wondering how often they are cleared from the tmp folder, and also if they get cleared if I was to rename the image while in the tmp folder
or would I have to do it manually
         

KonKalid
Utils I think that PHP is deleting the tmp folder upload files when the current PHP program ends
I know that this is the case with sessions and I know that when the program ends upload files are deleted , so it must be PHP that deletes those
but to be honest , I haven't tested this one
Robdgreat
KonKalid: sessions aren't deleted as soon as the script ends. It's normally done on a regular interval
KonKalid
of course
by PHP
Robdgreat
sessions would be useless if they only lasted the duration of one script execution
KonKalid
the question was if PHP is deleting tmp files of upload when the script ends or Apache
and I wrote that as session is being deleted by PHP I would assume that tmp uploaded files also are deleted by PHP
but I have done no tests my own on that ;)
Robdgreat
it seems temp uploaded files are in fact deleted at the end of the script, by PHP
per http://stackoverflow.com/questions/11131226/php-when-does-the-temporary-uploaded-files-gets-deleted
Utils
Sure... but would that still apply if I /changed/ the filename while it was in the tmp dir? So instead of moving it outside of the tmp dir, I leave itin there and change it?
Robdgreat
Utils: what happened when you tried it?
KonKalid
test it Utils , but what would this help ?
to test if PHP is clever enough ,,, No it isn't ;) ;) but this is not why we are using programming languages ;)
Utils
I'm trying to plan ahead. It's basically a form process where I resize the image, crop the image etc do whatever I need, save them in the tmp folder, and then I pass them both with their real filenames through curl to a remote server that's running node.
So I just wanted to find out ahead if I have to actually delete the modified file as it's not really a tmp file if I've created it myself.
imo
but Ill try I guess.
tbws
Utils: Renaming or copying the file will stop it from being deleted. Why don't you want to move it out of the /tmp folder?
Utils
because I don't need it to be out there. It gets sent to a remote server so it's still temporary, but under another name. but if that's the case, I will just delete the file afterwards.
no big deal.
Alphos
Utils if the file is renamed, php won't be able to know its new name, for obvious reasons
and if it doesn't have its new name, there's no way it can unlink it
tbws
Utils: Are you sure that you needa copy in the tmp dir on the originating server?
It sounds like you should just unlink it.
after the transfer
Or is that taking place in another process?
Utils
Ok so basically I have a small node web server which serves images on it's own vps. it also handles uploads. I'm unsure how to rename an uploaded file using another field's value (for example, if I uploaded image with another field for name)... so what
I have to do is save the image with its new name, create the thumbnail, also save that, and then send them both
and they will save with their original name.
It's the best I can come up with. So that's why I'm renaming/saving into the tmp dir and removing afterwards
:)
tbws
That sounds like a very messy way of doing it. What you have to do is not find a way around it but solve what you are unsure about.
Utils
I've tried, indeed. I can rename a file in node, but cannot access another field. I cannot find anything on google and I've asked in #node.js too. I'll still be continuing to figure it out, but I want to get some sort of basic (or messy) system set up and then improve on it.
tbws
Utils as this is a php channel lets go to pm's
Bruce_Dev
hey Viper-7 mind checking out my new repo? Its pretty small still but I think I better structored/set it up
Utils
Alrighty.
         

Bruce_Dev
I took an in development repo and started restructoring it, can anybody give me some tips on how I'm doing so far? https://github.com/navarr/MinecraftProfile - (old repo) | https://github.com/BruceDev/MinecraftProfile - (new repo)
testing.php is where you'll want to see how I set it up
its very basic right now but before I continue I wanted to get some tips before I get too deep and need to make alot of changes
my goals currently are making a prepare method when doing guzzle calls that handles all the decoding of json and errors. Also to fix up the composer crap and figure out alternatives to using an auto loader/composer crap for those who dont have it/want to mess with it
KonKalid
Bruce isn't all that under the same version ? so what is the reason of using different namespace and then use the use keyword for various components ?
cluelessperson
Argument 1 passed to html::AddStyle() must be an instance of string, string given, called in /var/www/html/digitalpay/index.php on line 4 and defined in /var/www/html/digitalpay/common/DigitalPay.php on line 32
I'm getting this error... the function is essentially AddStyle(string $location){
I'm passing it 'common/css/style.css'
Alphos
cluelessperson you cannot typehint the base php string type, you're actually typehinting an inexisting "string" class
Bruce_Dev
KonKalid, wasn't fond of his file structors/name spaces
KonKalid
I just asked ... if there is a reason I don't need to be font of anything
we use namespaces for that reason ...do define a namespace if we use a class in the same namespace what is the reason to use the "use" keyword ?
Bruce_Dev
mm not sure I'm aware of that term, but no real reason hehe, just pickiness on my part I guess, the fact he hasn't done anything in 6 months too made me feel I didn't need to be as strict on following his methods
where did I do that KonKalid ? wasn't aware my bad
seems I messed up on the interface name spaces though
I will fix that quick
KonKalid
you are in Classes/GuzzleStart.php and you namespace Minecraft\Classes;
tbws
Bruce_Dev: The layout of your repo is a little counter intuitive. Try something like this http://pastie.org/10355488 (I've omitted the config file as it's ultimately useless here. You can store the data in the classes properties instead.).
KonKalid
ok ... Munecraft\Classes is the namespace of this at all ?
Bruce_Dev
look at the composer.json
the autoloader sets Minecraft as
KonKalid
ok ... I was talking about PHP
Bruce_Dev
src/
viper-7 told me to make the namespaces somehow reference minecraft as its a minecraft library
so I decided to do it that way instead of having very long namespace names
KonKalid
ok ...that is has nothing to do with PHP although
Bruce_Dev
how so?
php uses name spacing, and autoloading
Viper-7
(his old namespace was something like Nathan\Classes\ApiCalls\APIClass, i told him to be more descriptive :P)
Bruce_Dev
@tbws I gotcha on that
KonKalid
why do we use name spaces ? why do we use autoloading ?
we have a reason for both
so ... read once again what namespaces are in PHP
Bruce_Dev
because name spacing is awesome and the autoloading goes with the name spacing
tbws
KonKalid: It will be better for him if you get to the point.
KonKalid
the point is name spaces in the context
Bruce_Dev
psr-4 autoloading
im hugely confused now
KonKalid
When I create a Module\ArdenAdmin namespace all the relative files are under the same name space
I don't use the "use" keyword except if I am referring to an outsider namespace
tbws
Bruce_Dev: What advice did you actually want because it seems like we are getting further and further away from the help that you need.
KonKalid
tnws +1
sorry tbws +1
Bruce_Dev
I think you provided good advice tbws, was just asking about the system structor for the minecraft api library im doing
« prev 1 2 3 4 5 6 7 8 9 10 11 12 13 14 next »