Jump to content

dfunk006

Members
  • Posts

    38
  • Joined

  • Last visited

About dfunk006

  • Birthday 11/06/1986

Contact Methods

  • Website URL
    http://www.blinkdigital.in

Profile Information

  • Gender
    Male

Recent Profile Visitors

3,319 profile views

dfunk006's Achievements

Jr. Member

Jr. Member (3/6)

18

Reputation

  1. hey @DedMoroz, That was a long time ago and I'm not quite sure I remember the details but let me try. Where have you placed your Hybridauth folder? If you put Hybridauth in the site/ directory, it will use the default PHP session.save_path. Your template in Processwire uses pw's session path (assets/sessions). You need to ensure that both the session paths are same for it to work. You can do this by commenting the following line in index.php //if(ini_get('session.save_handler') == 'files') ini_set("session.save_path", rtrim($config->paths->sessions, '/')); This will make pw's session.save_path as the default PHP session.save_path. Now session variables can easily be passes between PW and Hybridauth templates.
  2. There are, in fact, PDO drivers available for neo4j - https://github.com/jakewins/neo4j-pdo
  3. I wasn't asking for this to be built by Ryan. If I wanted to request this feature for the roadmap, I would have posted in the respective forum. I just wanted to discuss if there was any value to building something like this or not.
  4. That's an interesting analogy, although it's not quite the same. Graph databases can co-exist with mysql (a lot of people are using it that way), so its only an extension (maybe a core module) rather than a complete re-work. I'm not sure if anyone has seen neo4j's model. It's exactly like processwire! (http://neo4j.com/developer/guide-importing-data-and-etl/) Check out the part where it talks about the Graph Model. It says: A row is a node A table name is a label name Now this sounds familiar, doesn't it? In processwire's model: A row is a Page A table name is a field name Whoa! Looks like Ryan built a graph model in a relational database - absolutely brilliant! And that's not it, you can use Page fields to create connections between pages (much like creating connections between nodes to form a graph). Also, it's interesting to see the php implementation of neo4j, which also, coincidently, is very similar to processwire's API calls (https://github.com/neo4j-contrib/developer-resources/blob/gh-pages/language-guides/php/neo4jphp/index.php). $app->get('/graph', function (Request $request) use ($neo4j) { $limit = (integer)$request->get('limit', 50); $queryTemplate = <<<QUERY MATCH (m:Movie)<-[:ACTED_IN]-(a:Person) RETURN m.title as movie, collect(a.name) as cast LIMIT {limit} QUERY; $cypher = new Query($neo4j, $queryTemplate, array('limit'=>$limit)); $results = $cypher->getResultSet(); $actors = []; $nodes = []; $rels = []; foreach ($results as $result) { $target = count($nodes); $nodes[] = array('title' => $result['movie'], 'label' => 'movie'); foreach ($result['cast'] as $name) { if (!isset($actors[$name])) { $actors[$name] = count($nodes); $nodes[] = array('title' => $name, 'label' => 'actor'); } $rels[] = array('source' => $actors[$name], 'target' => $target); } } return json_encode(array( 'nodes' => $nodes, 'links' => $rels, )); }); If you notice, there's a cypher query which stores the results in a result array. Now, if we were to query a graph database and store the results in a PageArray, everything from there could be done processwire way (with access to processwire APIs). Graph Database seems like a natural fit to me for PW. Whether it's worth it or not is up for debate. Maybe there's performance improvements, maybe more flexibility or maybe just an alternative to mysql - i dunno. I pointed out a use case in my earlier post where graph db could be more useful, but I'm not sure - hence the discussion. Thoughts?
  5. Hi, Processwire makes efficient use of mysql - every field is a table and field-specific tables are joined on demand. However, joins are used nonetheless, especially in performing queries for $pages->find("selector") and related db-querying selector functions. So queries for $pages->find(field1=value1, field2=value2, field3=value3) will join field_field1, field_field2 and field_field3 tables. In this case, does it make sense to use graph databases (such as neo4j) compared to mysql? With data being connected now more than ever and with all the hype around graph databases and neo4j, will we see a potential support for graph databases in future releases of processwire?
  6. @Raymond Geerts - I ended up writing the login code in a template rather than a module (i figured it worked better that way). The code for integrating users is essentially taken from apeisa's Facebook Login Module - https://github.com/apeisa/FacebookLogin/blob/master/FacebookLogin.module code for authenticating with hybridauth: $hybridauth = new Hybrid_Auth( $ha_config ); $adapter = $hybridauth->authenticate( $provider_name ); $user_profile = $adapter->getUserProfile(); once you have successfully logged a user in with one of hybridauth's providers, you essentially need to call the processLogin function with the $user_profile object (I've made some modifications but they may not be necessary): Note: I have created a field - social_id and assigned it to users template. $social_id = $user_profile->identifier; $display_name = $user_profile->displayName; //you can capture additional information like email address, profile url, profile photo, etc from $user_profile object. see hybridauth for additional details. $name = $sanitizer->pageName($display_name, true).'-'.$social_id; $u = $this->users->get("social_id=$social_id"); // First we create random pass to use in login $uniqid = uniqid(); $pass = sha1($uniqid . $social_id . /*additional parameters can be added here*/); // User has logged in earlier with facebook id, great news let's login if ($u->id) { $u->of(false); $u->pass = $pass; /*$u->addRole(self::name);*/ //you can define a role for users $u->save(); } else { // User has not logged in before and autogenerate is on //I'm not using this but feel free to use this if you like. /*else if (!$this->disableAutogenerate) { $name = $this->sanitizer->pageName($fbUserData->name, true); $u = $this->users->get("name=$name"); // If there is already user account with same name than current logger has in facebook, then add a running number as a suffix //since i'm appending unique social ids in usernames, this problem will never arise if ($u->id) { if (!isset($fbUserData->counter)) { $fbUserData->counter = 2; $fbUserData->origName = $fbUserData->name; } else { $fbUserData->counter++; } $fbUserData->name = $fbUserData->origName . $fbUserData->counter; $this->processLogin($fbUserData); } */ // All seems to be fine, let's create the user // this is the main part $u = new User; $u->name = $name; $u->social_id = $social_id; $u->pass = $pass; /* $u->addRole(self::name);*/ $u->addRole("member"); //i've added a role called member //you can create additional fields like email, profile url, etc and add them here. $u->save(); } $this->session->login($name, $pass); $this->session->redirect(/*httpUrl*/); My code is a bit different as per my requirements, but the above code should work for basic hybridauth authentication and integration with PW users. Feel free to modify the code to suit your requirements. Hope this helps. Cheers!
  7. @Sanyaissues - yup, i have. Are you having trouble integrating with PW users?
  8. Oops! Sorry about that. Didn't realise I was crossing the line there. I shall be more cognisant about that from now!
  9. IMO, an alternative to the filesystem where files can be saved externally (like Amazon S3 or something) would really be helpful in a scenario like this. https://processwire.com/talk/topic/6046-alternate-filesystem/
  10. Hi, I think it would be really helpful to have an alternative to the default filesystem for large sites or sites that are hosted on distributed servers where the files can be saved externally to the likes of Amazon S3 instead of the '/assets/files/' folder, especially considering that filesystem on servers have a limit of either 32k or 64k for folders/sub-folders. This can be possibly achieved by creating a custom FieldType or a Module that can hook into the fileupload process, but having this built into the core would be a dream!
  11. Yes, a solution like this will surely be helpful for sites with large data or sites that are hosted on a distributed server architecture. If anyone is interested in developing a FieldType/Module for this, please let me know either via PM or by replying to this thread: https://processwire.com/talk/topic/6036-custom-fieldtype-for-amazon-s3/ and i'll be happily willing to sponsor it!
  12. Hi, Has anyone been able to save files on Amazon S3 instead of the local filesystem using File/Image Fieldtypes or creating a new Fieldtype?
  13. I too would like to save all assets to an S3 bucket instead of the local '/assets/files' folder. Is there a way to achieve this?
  14. dfunk006

    filepicker.io

    This looks very interesting indeed! Is there a way to use this inside Processwire so that images are uploaded to filepicker.io instead of the '/assets/files/' folder?
  15. Hi, Would anyone be interested in creating a custom fieldtype where images are uploaded to an Amazon S3 bucket instead of the /site/assets/ folder? Thanks
×
×
  • Create New...