Search the Community

Showing results for tags 'database'.



More search options

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • Welcome to ProcessWire
    • News & Announcements
    • Showcase
    • Wishlist & Roadmap
  • Community Support
    • Getting Started
    • Tutorials
    • FAQs
    • General Support
    • API & Templates
    • Modules/Plugins
    • Themes and Profiles
    • Multi-Language Support
    • Security
    • Jobs
  • Off Topic
    • Pub
    • Dev Talk

Found 67 results

  1. Hi, i need some help with a calendar script (Full Calendar) Issue 1 Its not saving to the database. This function dont work either when the script is running alone outside Processwire. Issue 2 (Fixed) When i click to ad an event and click save it wont turn up in blue, it just disapear. This function works when the script is running alone outside Processwire. ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- I have attached the script running alone so you can se how it works. I have also pasted the code below that im trying to work under the template folder inside Processwire. If you can look at the code and se whats wrong with it. Im not that good at PHP or Javascript so i need you help. demo http://demos.phplift.net/jquery-fullcalendar-integration-bootstrap-php-mysql/ home.php <?php include( "database.php" ); if ( isset( $_POST[ 'action' ] )or isset( $_GET[ 'view' ] ) ) //show all events { if ( isset( $_GET[ 'view' ] ) ) { header( 'Content-Type: application/json' ); $start = mysqli_real_escape_string( $connection, $_GET[ "start" ] ); $end = mysqli_real_escape_string( $connection, $_GET[ "end" ] ); $result = mysqli_query( $connection, "SELECT id, start ,end ,title FROM events where (date(start) >= ‘$start’ AND date(start) <= ‘$end’)" ); while ( $row = mysqli_fetch_assoc( $result ) ) { $events[] = $row; } echo json_encode( $events ); exit; } elseif ( $_POST[ 'action' ] == "add" ) // add new event section { mysqli_query( $connection, "INSERT INTO events ( title , start , end ) VALUES ( '" . mysqli_real_escape_string( $connection, $_POST[ "title" ] ) . "', '" . mysqli_real_escape_string( $connection, date( 'Y-m-d H:i:s', strtotime( $_POST[ "start" ] ) ) ) . "‘, '" . mysqli_real_escape_string( $connection, date( 'Y-m-d H:i:s', strtotime( $_POST[ "end" ] ) ) ) . "‘ )" ); header( 'Content-Type: application/json' ); echo '{"id":"' . mysqli_insert_id( $connection ) . '"}'; exit; } elseif ( $_POST[ 'action' ] == "update" ) // update event { mysqli_query( $connection, "UPDATE events set start = '" . mysqli_real_escape_string( $connection, date( 'Y-m-d H:i:s', strtotime( $_POST[ "start" ] ) ) ) . "', end = '" . mysqli_real_escape_string( $connection, date( 'Y-m-d H:i:s', strtotime( $_POST[ "end" ] ) ) ) . "' where id = '" . mysqli_real_escape_string( $connection, $_POST[ "id" ] ) . "'" ); exit; } elseif ( $_POST[ 'action' ] == "delete" ) // remove event { mysqli_query( $connection, "DELETE from events where id = '" . mysqli_real_escape_string( $connection, $_POST[ "id" ] ) . "'" ); if ( mysqli_affected_rows( $connection ) > 0 ) { echo "1"; } exit; } } ?> <!doctype html> <html lang="sv-se"> <head> <meta http-equiv="Content-Type" content="text/html;charset=utf-8"/> <style type="text/css"> img { border-width: 0 } * { font-family: 'Lucida Grande', sans-serif; } </style> <style type="text/css"> .block a:hover { color: silver; } .block a { color: #fff; } .block { position: fixed; background: #2184cd; padding: 20px; z-index: 1; top: 240px; } </style> <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.0/jquery.min.js"></script> <script src="<?=$config->urls->templates;?>js/script.js" type="text/javascript"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js" crossorigin="anonymous"></script> <link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet"> <link href="<?=$config->urls->templates;?>css/fullcalendar.css" rel="stylesheet"/> <link href="<?=$config->urls->templates;?>css/fullcalendar.print.css" rel="stylesheet" media="print"/> <script src="<?=$config->urls->templates;?>js/moment.min.js"></script> <script src="<?=$config->urls->templates;?>js/fullcalendar.js"></script> </head> <body> <div class="container">fsefsefes <div class="row"> <div id="calendar"></div> </div> </div> <!-- Modal --> <div id="createEventModal" class="modal fade" role="dialog"> <div class="modal-dialog"> <!-- Modal content--> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">&times;</button> <h4 class="modal-title">Add Event</h4> </div> <div class="modal-body"> <div class="control-group"> <label class="control-label" for="inputPatient">Event:</label> <div class="field desc"> <input class="form-control" id="title" name="title" placeholder="Event" type="text" value=""> </div> </div> <input type="hidden" id="startTime"/> <input type="hidden" id="endTime"/> <div class="control-group"> <label class="control-label" for="when">When:</label> <div class="controls controls-row" id="when" style="margin-top:5px;"> </div> </div> </div> <div class="modal-footer"> <button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button> <button type="submit" class="btn btn-primary" id="submitButton">Save</button> </div> </div> </div> </div> <div id="calendarModal" class="modal fade"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <button type="button" class="close" data-dismiss="modal">&times;</button> <h4 class="modal-title">Event Details</h4> </div> <div id="modalBody" class="modal-body"> <h4 id="modalTitle" class="modal-title"></h4> <div id="modalWhen" style="margin-top:5px;"></div> </div> <input type="hidden" id="eventID"/> <div class="modal-footer"> <button class="btn" data-dismiss="modal" aria-hidden="true">Cancel</button> <button type="submit" class="btn btn-danger" id="deleteButton">Delete</button> </div> </div> </div> </div> <!--Modal--> <div style='margin-left: auto;margin-right: auto;text-align: center;'> </div> </body> </html> database.php (i have configure this in my file at localhost) this is just an example. <?php $connection = mysqli_connect('host','username','password','database') or die(mysqli_error($connection)); ?> js/script.js $(document).ready(function(){ var calendar = $('#calendar').fullCalendar({ header:{ left: 'prev,next today', center: 'title', right: 'agendaWeek,agendaDay' }, defaultView: 'agendaWeek', editable: true, selectable: true, allDaySlot: false, events: "home.php?view=1", eventClick: function(event, jsEvent, view) { endtime = $.fullCalendar.moment(event.end).format('h:mm'); starttime = $.fullCalendar.moment(event.start).format('dddd, MMMM Do YYYY, h:mm'); var mywhen = starttime + ' - ' + endtime; $('#modalTitle').html(event.title); $('#modalWhen').text(mywhen); $('#eventID').val(event.id); $('#calendarModal').modal(); }, //header and other values select: function(start, end, jsEvent) { endtime = $.fullCalendar.moment(end).format('h:mm'); starttime = $.fullCalendar.moment(start).format('dddd, MMMM Do YYYY, h:mm'); var mywhen = starttime + ' - ' + endtime; start = moment(start).format(); end = moment(end).format(); $('#createEventModal #startTime').val(start); $('#createEventModal #endTime').val(end); $('#createEventModal #when').text(mywhen); $('#createEventModal').modal('toggle'); }, eventDrop: function(event, delta){ $.ajax({ url: 'home.php', data: 'action=update&title='+event.title+'&start='+moment(event.start).format()+'&end='+moment(event.end).format()+'&id='+event.id , type: "POST", success: function(json) { //alert(json); } }); }, eventResize: function(event) { $.ajax({ url: 'home.php', data: 'action=update&title='+event.title+'&start='+moment(event.start).format()+'&end='+moment(event.end).format()+'&id='+event.id, type: "POST", success: function(json) { //alert(json); } }); } }); $('#submitButton').on('click', function(e){ // We don't want this to act as a link so cancel the link action e.preventDefault(); doSubmit(); }); $('#deleteButton').on('click', function(e){ // We don't want this to act as a link so cancel the link action e.preventDefault(); doDelete(); }); function doDelete(){ $("#calendarModal").modal('hide'); var eventID = $('#eventID').val(); $.ajax({ url: 'home.php', data: 'action=delete&id='+eventID, type: "POST", success: function(json) { if(json == 1) $("#calendar").fullCalendar('removeEvents',eventID); else return false; } }); } function doSubmit(){ $("#createEventModal").modal('hide'); var title = $('#title').val(); var startTime = $('#startTime').val(); var endTime = $('#endTime').val(); $.ajax({ url: 'home.php', data: 'action=add&title='+title+'&start='+startTime+'&end='+endTime, type: "POST", success: function(json) { $("#calendar").fullCalendar('renderEvent', { id: json.id, title: title, start: startTime, end: endTime, }, true); } }); } }); database table CREATE TABLE events ( id int(11) NOT NULL AUTO_INCREMENT, start datetime DEFAULT NULL, end datetime DEFAULT NULL, title text, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ; fullcalendar.rar
  2. Hi, I have a project that, based on initial specs, I decided to build in another framework due to the client wanting the ability to regularly import data from an existing manufacturing system. I decided a platform that would allow me to match the imported data to the system would make sense. Since then, the project has morphed (I know, it never happens) and the regular import is unnecessary and so a comprehensive admin is needed. I want to switch to PW but don't want to have to manually link thousands of tables. I have the import routine working for the main table but I am not sure how to import the support tables and automatically create the page fields for them. Oh, in case it matter, the links are not autoincrement id fields, but character codes. Eg. Category table - code: TRN, description: Transportation If someone can point me in the right direction it would be much appreciated.
  3. This is a simple loader for LessQL, an ORM alternative for PHP. It is based on NotORM, and provides a quick way to access and find things in a database, including traversals and back-traversals. As discussed in some earlier topics, there are times when you'd like to store some data away from ProcessWire's pages/fields/templates structure for whatever reasons. However ORMs are sometimes cumbersome and requires a lot more effort to deploy. LessQL offers a quick way to just up and go like you're using an ORM but without the added complexity and configuration files. Module: https://github.com/alguintu/LessQL This modules simply loads the LessQL library into ProcessWire and exposes a $lessQL variable (configurable in settings) that gives access to your database. It uses the same database specified in $config by default, but can be set to use a separate database, along with its credentials. Usage given a table person : $people = $lessQL->person()->select("id, firstname, lastname")->where("firstname LIKE ?", "%alex%")->orderBy("firstname")->limit(10); It uses lazy loading and doesn't execute the query until it needs to. Checkout www.lessql.net for more info on LessQL. Module wrapper is pretty much lifted from @teppo's RedBeanPHP module, but with a few modifications.
  4. I was going to start working on a new site for myself and wife (a new hobby we have taken up), and had decided to try out Runcloud and Digital Ocean. I got my drop set up on digital ocean, as well as setting up various hooks/databases etc between github and run cloud. However, now I have hit a wall. I cloned my "blank" repository into my local host (managed through MAMP) and dropped in a fresh install of PW, but now I have no idea of how to move forward. Is it best to just work locally, and then push this into a branch, and when ready, change branches and commit all to run cloud? Run cloud gives me an IP address to use for the database, but I can't get my localhost setup to recognize (I just get "Connection refused"). I am also unsure how to actually get my commits to push to run cloud, and handling the new set up. I am probably in over my head, but I thought I would try something new as a good learning experience. However, now I am just drowning . Hopefully someone has some ideas on how to approach this, as I am very eager to get under way.
  5. Hi Everyone, Since a couple of months, we have our new website live with processwire as CMS system. In this website there is a huge database (1900+ trees), wich can be found with different filters. Take a look at www.vdberk.com/trees. The website does not to be seen very fast when you select a couple of filters. Every time there is a delay between 3-5 seconds. Now we are migrate the website to another sever, with more preformance. So we hope this give us some timeprofits. Does anyone have any kind of suggest, to make this filter faster. Now the website is on PHP5.6, is php7 better? Can this make a different? We used ProCache already. Thanks in advance
  6. I encountered a situation over the past few months where tables have been crashing when a user saves a page in PW. I'm assuming it is something related to the server/hosting provider (Site5), because it only happens on this host, but across completely different unrelated accounts. When it happens the table in question gets "marked as crashed", and then shows "in use" when you see the table in PHPMyAdmin. No data is retrievable by PW from whichever table/field is crashed, so if the body table crashes, then the front end doesn't show any body text anymore until someone goes into PHPMyAdmin and repairs the table. I'm trying to make a module or at least some button the client can click from their admin that will run a repair on the tables so i don't have to help them and go to their cPanel etc.. I added a button on the dashboard of the sites in question (for sites that i use a dashboard on), or i told them to bookmark the link to the repair process, something like example.com/repair_database.php?action=repair; so far it seems to work but wanted to check to see if anyone sees any problems or improvements to this, it was done in only a few minutes, so may have left out something... I'm not sure if this could/should be made into a module, since it is conceivable that a table could crash that would render the modules system non functional, so thought maybe better to be a bootstrapped script(?) <?php // in root of pw installation - this is the 3.0+ version; repair_database.php /* Bootstrap PW ----------------------------------------- */ include("/home/path/to/index.php"); $config = \ProcessWire\wire('config'); $user = \ProcessWire\wire('user'); if(!$user->isLoggedin()) die("access denied"); function optimizeTables() { $tables = array(); $db = \ProcessWire\wire('db'); $result = $db->query("SHOW TABLES"); while ($row = $result->fetch_assoc()) { $tables[] = array_shift($row); } foreach ($tables as $table) { $result = $db->query("OPTIMIZE TABLE `$table`"); while ($row = $result->fetch_assoc()) { echo $row['Table'] . ': ' . $row['Msg_text'] . "<br /> \n"; } } } function repairTables() { $tables = array(); $db = \ProcessWire\wire('db'); $result = $db->query("SHOW TABLES"); while ($row = $result->fetch_assoc()) { $tables[] = array_shift($row); } foreach ($tables as $table) { $result = $db->query("REPAIR TABLE `$table`"); while ($row = $result->fetch_assoc()) { echo $row['Table'] . ': ' . $row['Msg_text'] . "<br /> \n"; } } } ?> <!doctype html> <html lang="en"> <head> <meta charset="utf-8"> <title>Database Repair &amp; Optimize Tool</title> </head> <body> <pre> ____ _ ____ __ __ / __ \___ ____ ____ _(_)____ / __ \____ _/ /_____ _/ /_ ____ _________ / /_/ / _ \/ __ \/ __ `/ / ___/ / / / / __ `/ __/ __ `/ __ \/ __ `/ ___/ _ \ / _, _/ __/ /_/ / /_/ / / / / /_/ / /_/ / /_/ /_/ / /_/ / /_/ (__ ) __/ /_/ |_|\___/ .___/\__,_/_/_/ /_____/\__,_/\__/\__,_/_.___/\__,_/____/\___/ /_/ </pre> <?php if($input->action == 'repair') { repairTables(); } if($input->action == 'optimize') { optimizeTables(); } ?> </body> </html> example button:
  7. My Database is cancelled for error. I I create new database by cpanel, then I add it to domain processwire by cpanel, with same password and same username! But processwire don't identify it! What I wrong?
  8. i am newbie, so i'm sorry for silly question.. i want to insert data to my database. this is my syntax $pDOStatement = $database->query("INSERT INTO questions (ID_USER,TIME_Q, QUESTION) VALUES (1,NOW(), $pertanyaan)"); for $pertanyaan is my variable which string. but, i get error (in attacment) please help. thx
  9. Hi, my server or processwire or me cancelled database, that don't exist and my server haven't backup. The error log is: http://www.permaculturaorganica.info/?/ Error: Exception: SQLSTATE[HY000] [1044] Access denied for user 'casbo_RdS'@'%' to database 'casbooko1_po' (in /data/vhosts/permaculturaorganica.info/httpdocs/wire/core/ProcessWire.php line 308) Is this log a log for database not found, it's correct? I was write any articles, but NOT PUBLISH, because the site haven't any grafic. Now I go in /site/assets/cache/ by ftp, but I don't see any file. The address is correct for find the files cache?
  10. Hi all, Just wondering if its safe to delete the content of the cache table manually within the database?
  11. When I take a look in a PW database I see this: pages are stored in “pages", templates are stored in “templates", sessions are stored in “sessions", forms are stored in "forms” (form builder), ... I want to make a website with a large catalog (1.5 million products). I don’t want that the products are stored in “pages” table in the database, but in the “products” table. Is this possible in PW? End will I maintain the same options, then when I store all products in “pages”? Some advice would be helpful! Kind Regards, Peejay
  12. Hello, I am truly stuck. I have a website I built for a client that has become quite successful: http://drydenwire.com It is an independent news agency. The problem is, I built everything from scratch in Processwire and things were purring along until the traffic went up. Now, I keep getting these huge spikes which last about 15 seconds and cause all users to receive a 503 Error. I have created a public repo for review: https://github.com/scramlo/DrydenWire.com/tree/master and can answer any questions that may lead to an answer. I am willing to hire a more experienced developer if the community is unable to help me mine out this issue. I have gone through the usage logs and know that all traffic is legitimate, I am not getting bombarded by a spam IP address or anything like that. Thank you for any and all assistance as this client is getting frustrated and I would rather not lose them!!! -Brian
  13. SQLSTATE[42S02]: Base table or view not found: 1146 Table 'hortons.pages' doesn't exist (in /srv/users/serverpilot/apps/hortons/public/wire/core/WireDatabasePDO.php line 439) Getting this error after upgrading from 2.4 to 2.8 then exporting the site profile and installing on the latest version of v3. Anything I could do about this, anyone come across this? thanks Edit: The issues started going from 2.4 to 2.8 - I used the upgrading advice on the github, replacing PW files. Im running ubuntu 14.4.x using serverpilot.io. The site hosting was originally not controlled by me so am trying to rehost and upgrade.
  14. Hi there, I was wondering if page->url and page->httpUrl are stored anywhere in the backend? I haven't been able to locate it so I'm beginning to think these are generated or calculated on the fly? Thanks in advance
  15. Hi guys, I've just discovered Processwire and I'd like to build my new project on it. It seems PW is the tool I was looking for. It's my first post and I guess many others are coming A few words about me : I live in France, I used to be a php dev (looong time ago), became a MySQL DBA during a few years and now a little less hands-on (except on that project). Speaking of the project, it's the complete rewrite of a game related to motorcycle races (you have to guess the podium in different categories). I have players who sign up, record a prediction for the next Grand Prix, get a ranking according to the precision of their prediction (vs real results). They have a profile page, etc. The frontend is based on data which is updated each Grand Prix (through some pure croned php scripts). The website sends automatically newsletters according to the date (vs the races calendar) and the same goes for the email which warns players their score was updated. It runs for years now. My goal is to reach thousands of players on this new version. I'm not anxious about speed here, I guess it will be ok, and I'll probably be a future client of ProCache and ProdevTools (yes I saw the coupon code :). That also will be my way to support the work which has been done here. Actually I'm rewriting the whole stuff (based on pure Php) and I will host more races next year (more categories, more players, more... everything). I'm interested in PW because I'm looking a modern way to rebuild my website without reinvent the wheel : using all the built-in stuff from PW (routing system, session/authentication, and all what the other modules can offer !). OK, enough for the project Although I've been through some different tutorials and read tons of thread on this forum for the last 3 days... I didn't yet make my mind on the solution to choose : "pure" SQL queries or use the API/pages. As I said before, I'm a DBA, I'm ok with queries and I've already wrote most of them. Actually, I see how to import my tables into the PW's database, so I can directly connect to my old tables (you call that custom tables I think) with the db handler which is passed to every page. I see how to create a template, I see how to choose the ouput strategy, but I have some difficulties to see how to add content to each page. I don't know if I need all this actually. I've read this very useful thread : https://processwire.com/talk/topic/18-how-do-i-import-lots-of-data-into-pages/ from @ryan, who answered a very good question from @jbroussia Technically speaking I understand the stuff but perhaps it's overkill for me. I'm looking for the easiest/quickest solution (I have so many things to code before launch :-/). According to you, can I survive without importing all my data in PW fields by using this way : $result = $db->query("SELECT id, name, data FROM some_table"); while($row = $result->fetch_array()) print_r($row); As I said the DB is updated frequently (each Grand Prix) and each player's score is updated in the same time, that goes for the different categories, well a lot of stuff is moving at each Grand Prix. According to me it should work with template + page using that template but without filling the fields... ? Moreover I'm afraid of losing some PW functionnalities here : Accross my readings I've picked up some quotes which I haven't completely understood, perhaps you can help me on that. - "If you want to present your data at unique URLs, then pages is the way to go.... " (from https://processwire.com/talk/topic/5325-database-table-versus-pages/) - "While it's there and ready for you to use, it's always preferable (not to mention easier and safer) to use ProcessWire's API for accessing any of it's data." - "If you went the pages route, you can also harness the extended power of templates, e.g. using templates to control page access..." (from https://processwire.com/talk/topic/17-functionsmethods-to-access-the-db/ -> I understand it's "easier" to use the API, but why is it "safer" than my own SQL queries ? I still have to sanitize myself any user entries in both case for example no ? -> Won't I be able to control page access if I'm not using the API ? I didn't dig into control access yet, please forgive me if the question is a nonsense. -> What about the uniqueness of URL that is mentionned in my first link ? Well, I think that's enough for a first post and thanks in advance for your answers.
  16. Hi, I have several questions about modules: Where are modules settings saved? In the database? If yes, in which table? Where are modules fields saved? Again, in the database? If I were to git control my website, should I ignore modules folder?
  17. We are currently looking at building a custom administration area with the basic outlined functionality. Users will be able to login and see their horses, their events and their payments. Admins will be able to login and see all users, horses, events, payments. Data structure below. Questions 1) Would this make sense to build as a single frontend with different 'admin' levels' rather than customising the backend of PW? Ultimately the PW install will be running a full frontend website (showing Horses for Sale, Events and other misc content) so users will need to login to update content. 2) How does PW handle database relationships? Could this structure be built? Users ------ ID Email Horses - one user can own many horses ------- ID UserID Membership Level (payment) Events - one horse can enter many events ------- ID HorseID Required Membership Level Payments ----- ID TransactionID Payment Items - one payment can have many payment items ---- ID PaymentID Order Type - Horse Registration/Donation/Event ItemID - HorseID, DonationID, EventID Cost VAT Many thanks Pete
  18. I'm not sure that I really follow this page; http://imgur.com/a/hCxqg I've created a database when setting up the server, so I'm presuming that this is what's being asked for here? The page linked for getting setup http://webdesign.tutsplus.com/tutorials/how-to-install-and-setup-processwire-cms--cms-25509 doesn't really mention anything about these fields. After trying to use the user name on the server, and the password that I entered when setting up the mySQL to start with I got the following error (so I had filled in "DB Name"={some name that I thought up }, "DB user" = {name of user on server}, "DB pass" = {pass i set up for mySQL}); http://imgur.com/a/cgFKq After this i tried using db name; {whatever} db user; {name of user on server} db pass; {password for user on server} This didn't work either, so I'm not sure what I'm meant to put here.
  19. After working with PW for quite so time i came to my first issue: After testing around I added pages "part" with few fields and repeater. $p = new Page(); $p->template = 'part'; $p->parent = '/parts/'; $p->name = $pageName; $p->save(); $p->of(false); .... // adding repeater $store = $p->pStores->getNew(); $store->sCount = $sCount; $store->sPartNr = $sName; $store->sPrice = $sPrice; $store->sStore = $pages->get(24464)->id; $store->save(); $p->pStores->add($store); $p->save(); added about 1600 items. Later on I deleted them Using foreach ($pages->get('/parts/')->children as $p){ wire('pages')->delete($p); } Now i can't add any repeater items to new pages I create using code above. It gives me error Can't save page 0: /1473421482-73-1/: It has no parent assigned Now I try to delete repeater field and recreate it. But it says that Can't delete template 'repeater_pStores' because it is used by 1685 pages. But there are no pages. I looked in DB. and found that repeater fields still hold values for pages that does not exists. [EDIT]: found that pages still exist in db. So i deleted them manually. Recreated field but same problem stands. Im not sure in witch step I fcked up, but can someone point fingers at me and tell what i did wrong or why its not working?
  20. The situation I'm trying to arrive at a good solution for is how to store user-created data in a production environment. We're pre-production but the issue I'm running into is that storing user-data as pages creates problems when it comes time to update the production site with a new version (of our site, not PW). Because I'm adding data as pages the data will be deleted if I create a backup and restore it to the production environment. I've spent a fair amount of time writing some DB compare logic to find differences but that will require manual updating for each difference. Because pages reference other page numbers via IDs and the production environment will be creating users and meta-information pages it isn't possible to save/restore those particular pages around a backup (from development) and restore (to production) of the PW database. It seems like the most straightforward approach is to put the user-created data in separate tables so that PW information can be updated independently. That is pretty easy using $db or $database. Are there any best practices for this kind of thing? Am I thinking about it wrong? How is this problem generally solved? The user-data is 1) user accounts and 2) meta-information about uploaded files (stored in the file system).
  21. I need to write a lazy cron job that goes through a list of files and deletes those that are associated with expired sessions. Our session information is stored in the DB table sessions. Is there a Wire API call that allows me to do one of: 1) fetch all expired sessions? 2) hook the session expiration event? 3) fetch all active sessions? 4) do direct DB access to lookup sessions? (least preferred as I have to directly tie to session implmentation). My logic can either flow: Find active sessions delete files NOT in active sessions Get files if session_id associated with file NOT in sessions (or has expired) delete file.
  22. I'm in need of changing the charset for my site but I couldn't find any way of doing so since changing $config->dbCharset = 'utf8'; in wire/config.php gave me an error when I tried to install. I couldn't find anyway of changing charset during the installation configuration either. So how do I do it? I need it to be set to Swedish language so that I can sort letter like Å,Ä and Ö proper.
  23. Hello, How would I get the DB query that is used to gather the data for something like wire('pages')->find("template=log, id_gc={$serverId}, timestamp>={$dateStart}, timestamp<={$dateEnd}, sort=timestamp"); Tried using the Debug Mode Tools in the backend on a lister with similar selector. But I couldn't make out the right query in there. I'd like to use that query directly to dump data from the DB to a csv via SELECT INTO. Processing 10.000s of pages in chunks of 100 via the API into a csv. This is quite time consuming (several minutes for ~20.000 pages that result in a ~13MB csv file). Any help would be much appreciated.
  24. Hi guys I'm trying to duplicate a ProcessWire site on a different server so I can work on it. The good news is the live and the test servers are identical VPS. I already have multiple PW sites running on both. I can export the DB from the Live server but when I try to import to Test server I get the following error. Am I correct in thnking this error in the SQL syntax is being generated at the export stage? IE my Live PW site wouldn't be working with a syntax error so I must be messing up the export of the .sql file There is nothing at line 48 but a find command shows CREATE TABLE `fieldtype_options` ( `fields_id` int(10) UNSIGNED NOT NULL, `option_id` int(10) UNSIGNED NOT NULL, `title` text, `value` varchar(255) DEFAULT NULL, `sort` int(10) UNSIGNED NOT NULL ) ENGINE=MyISAM DEFAULT CHARSET=utf8; BTW, my server setup is: Version Plesk v12.5.30_build1205150826.19 os_CentOS 6 OS CentOS 6.3 (Final) MySQL: 5.5.41 PHP: 5.6.19
  25. Hello, will the database structure change until stable release of ProcessWire 3 or won't the database be touched? This would be great to know, Ryan!