Wanze
PW-Moderators-
Posts
1,116 -
Joined
-
Last visited
-
Days Won
10
Everything posted by Wanze
-
Hi Sevarf2 Pw's solution with the extended paths uses another directory structure, so you need to migrate the files somehow. Here's a link to a gist from my migration script: https://gist.github.com/wanze/e8051e0bf754c2f75083 Basically I'm doing the following stuff: Rename "site/assets/files" to "site/assets/files_old" Create a new "site/assets/files" folder Loop the pages and copy all their files from old location to new location (using pageFileExtended) That's it. If anything goes wrong, all files are still available in the old directory. Cheers
-
ProcessWire + Ionic : Handling User Authentication & Sessions
Wanze replied to Vineet Sawant's topic in Getting Started
Since Ionic is on top of Angular, here's a good article: https://auth0.com/blog/2014/01/07/angularjs-authentication-with-cookies-vs-token/ -
Same solution as Reno, but I'd compare the timestamps and not date strings $now = time(); $expires = strtotime($page->select_timed_expire); // If you have a date string as output format
-
Hi rick, I don't think there is a setting, at least I've never heard of one... Cheers
-
@Juergen Check out the Cheatsheet, you find it under "Files": http://cheatsheet.processwire.com/
-
It's ProcessWire Use: $pageFile->filename; // Path & Filename $pageFile->basename; // Filename without path $pageFile->filesize; // Size in bytes $pageFile->filesizeStr; // Human readable Filesize
-
@Mackski Yeah, it's always good to add additional checks. In this situation, $file->isDownloadable() is not necessary, as this check is performed by $file->donwload(). Also ProcessWire's wireSendFile will exit for you if the file was sent
-
I guess you are using the module in the frontend? You will have to implement this logic on your own. A possible solution would be to use a GET variable or a url segment to indicate a download, something like this: if ($input->get->download == 1) { $yourSecureFile->download(); }
-
Thanks for the feedback guys, I'll look into it. @Mackski The option to define the path relative to the root directory makes sense to me, I will add this as an option in the next version. Cheers
-
$productpriceitems = $child->find("template=productpricelistitem, sort=-standardprice")->sort("-offerprice");
-
Sorry, I wanted to write the following: $productpriceitems = $child->find("template=productpricelistitem, sort=-standardprice, sort=offerprice");
-
Hi Juergen, Did you try: $productpriceitems = $child->find("template=productpricelistitem, sort=-standardprice, offerprice");
-
What's the HTTP code returned with this error? I guess the error message is from Apache and not from ProcessWire?
- 5 replies
-
- Permission
- Options field
-
(and 1 more)
Tagged with:
-
Selector to find pages with identical value in a field?
Wanze replied to Webrocker's topic in API & Templates
I'd still delete them with the ProcessWire API. This makes sure that also related data in the "field_xx" tables as well as files get deleted properly. To solve the timeout issues, I see two options: Run the "cleanup-script" via command line by bootstraping Pw, usually timeout is no problem there, as Apache isn't involved. Group your pages into chunks with the help of "start" and "limit" in your selector. Or both together Cheers -
@valan Looking through your code, I think that the problem could be this line: https://github.com/valieand/GoogleCidCatcher/blob/master/GoogleCidCatcher.module#L195 If your array is empty, you get a strange selector string. Also you are using array_filter without actually filtering anything in the array, not sure how PHP behaves. Normally you'd need to pass a closure as second argument, see: http://php.net/manual/en/function.array-filter.php Edit: Ok just read the docs, if you omit the closure as second argument when using array_filter, all FALSE entries are removed.
-
Selector to find pages with identical value in a field?
Wanze replied to Webrocker's topic in API & Templates
Hi Webrocker, A direct MySQL query is the way to go here. The solution from LostKobrakai works, in the context of ProcessWire the query looks like this: SELECT pages_id, COUNT(data) AS count FROM field_legacy_id GROUP BY data HAVING count > 1 Now you can extract the page IDs from the result and delete these pages via the Pw API, as there is existing a duplicate post. Note that if the count is greater than 2 somewhere, you'd need to execute this query more than once. -
@CodeCoffeCode Don't worry, we've all been in this situation before
-
A ProcessWire Fieldtype storing files in a customized location, outside the web root. This module is primarily useful if you need to store sensitive data which should not be accessible directly from the web. Normally, ProcessWire stores all files under /site/assets/files. Direct URL access to these files can be restriced by setting $config->pagefileSecure = true. Still you need to make sure that your template permissions are setup correctly. If something goes wrong, those files could be accessed from outside. GitHub: https://github.com/wanze/FieldtypeSecureFile Modules Directory: http://modules.processwire.com/modules/fieldtype-secure-file/ How does it work? After installing this module, you can create a new field of type SecureFile. Enter your configuration under the "Details" section when editing the field: Storage Location Enter a path outside the web root where the files are stored. You need to create the directory manually. Also make sure that the user running the web server has write permission. Roles allowing to download a secure file Users with a role selected here are able to download the files if a download is requested via the API. Allow Download in Admin If checked, users having a role selected above can download the files when editing a page. I needed this functionality for a recent project, so I created this module and thought to share it, mabye this is useful for someone else Consider it beta, I'm using it on one site but I'm sure it could be improved here and there. Feel free to suggest additional features! Cheers
- 85 replies
-
- 24
-
Fatal error: Exception: SQLSTATE[HY000]: General error:
Wanze replied to onjegolders's topic in General Support
Yep, MySQL can't write in this directory. -
I doubt that this is the problem, but anyway: Do you use some sort of cache (Templates cache, Markup Cache, ProCache) ? Maybe you see a cached version of the page.
-
Get the 'running' page in hooked property.
Wanze replied to MichaMichaMicha's topic in Module/Plugin Development
@MichaMichaMicha Reading your question again, I think I didn't fully understand it before You can grab the actual page with $page = wire('page'); -
Get the 'running' page in hooked property.
Wanze replied to MichaMichaMicha's topic in Module/Plugin Development
If you need to add a hook only to the current page, you don't need to add it on all Page instances. Instead, you can attach it only to the current page instance: $page = wire('page'); $page->addHookAfter('path', 'modifyUserPagePath'); Then you don't need your check for the template. Where are you defining this hook? In an autoload module in the init() method? -
Hi Manol, You have to enter the redirect URL in the Google API console. Google needs to know the URL of the app. Cheers
-
"Continuous integration" of Field and Template changes
Wanze replied to mindplay.dk's topic in General Support
@mindplay.dk I'd be interested in this project, could you add me on bitbucket? My username is "wanze". Thanks -
Hi rick, Welcome to the world of ProcessWire! Enjoy the journey and good luck with your upcoming projects Cheers